C Array address confusion -


suppose have following code:

main () {   char string[20];    printf(" string %s \n " , &str); } 

what printf(" string %s \n " ,&str); give?

suppose str points location 200, &str give??

not sure want, according question title, might want know couple of things array addresses:

 main () {   char string[20];   char *str = &string;    printf("the string addr %p \n" , &string);   printf("the string addr %p \n" , &string[0]);   printf("the string addr %p \n" , str);   printf("the string addr %p \n" , &str[0]); } 

all these equivalent ways address of "array". address of array address of first element of array.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -