Pointers and Arrays in C - Extremely confused -
this question has answer here:
- what difference between char s[] , char *s? 12 answers
i have learned traditional way of declaring character array follows:
char c[] = "john"; however, have noticed can declare as:
char *c = "john"; how work? know has pointers, please elaborate? appreciated.
in first example, c array of char. in:
char *c = "john"; c here not array pointer (type char *) string literal. pointers , arrays different types in c.
below link if want learn pointers , arrays:
Comments
Post a Comment