Pointers and Arrays in C - Extremely confused -


this question has answer here:

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:

http://www.torek.net/torek/c/pa.html


Comments

Popular posts from this blog

Using 'OR' and 'AND' in SQL Server -

python - Finding intersection between ellipse and a line -

c++ - NetBeans Remote Development with additional configuration -