dev c
CtrlK
  • Introduction
  • Variable
  • Data Type
    • Data model
    • Data Alignment
      • stdint.h
  • Escape Sequence
  • First Chapter
  • How to C in 2016
  • Head Files
  • Struct
  • Compiler
    • GCC
    • Clang
  • Design Pattern
  • Pointer
    • Pointer 運算
    • With Array
    • New and Delete
    • Memory Allocation
    • Pointer to Pointer
    • char pointer
    • function pointer
  • STDIO
  • Variable-length argument
  • Struct
    • Struct and Pointer
    • Union
  • Advanced
    • pragma
  • C Library
    • assert.h
    • string.h
  • swap function
  • Function
    • Basics
    • Use function as args
  • Operator
    • Increment, Assignment, Decrement
  • Operators
  • Associative Array
  • 題庫
  • Array
    • Strings
Powered by GitBook
On this page

Was this helpful?

  1. Pointer

char pointer

#Char Pointer

char pointer 可以直接類似當作變數用, 因為字元指標可以直接參考到字串常數

char *str = "Hello";

str = "World";

注意 - 如果是陣列則不行:

ex:

char str[] = "Hello";

str = "World"; //error incompatible type in assignment

PreviousPointer to PointerNextfunction pointer

Last updated 4 years ago

Was this helpful?