In case of pointers *p
means value stored and p
means the address (for a declaration int *p
).
As per the below declaration, name
points to the string "Example". So *name
would be "E" and NOT an address, but an actual value. So how does the program below work? I mean, we are incrementing the value itself and not the pointer (confused).
char *name="Example";
while(*name !='\0'){
printf("%c\n",*name++);
}
Prints
E
x
a
m
p
l
e