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

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -