problem with string
i am not able to catch the difference between the following two piece of code
1 2
|
char name[20]="john";
printf("%s",name);
|
and
1 2
|
char name[20]="john";
printf("%s",&name);
|
why do both give me the same output?If both are same why does the following statement give me garbage value
printf("%s",&name+2);
whereas
printf("%s",name+2);
gives me the expected output...
plz help me in getting a crystal clear picture of this
Last edited on
Topic archived. No new replies allowed.