I define b as pointer to string:
char a[] = "hello";
char *b;
strcpy(&b, a);
So far so good (although I don't quite understand why b=&a doesn't work, considering that both a and b are pointers).
Now when I want to print the string pointed to by b, I have to use &b:
printf("%s", &b);
Why do I need to give address of a pointer to printf(), in order for contents of the variable that this pointer points to be printed?? Why printf("%s", *b) doesn't work?
Contrast this with syntax for pointer to integer:
int c = 5;
int *d;
d = &c;
printf("%d\n", *d);
Makes full sense.
I am aware that strings syntax is different in a sense that string name is also a pointer. Not sure I understand why such special rule for strings is required though, but fine, after banging my head against the wall few times, I forced-learned this. But printf("%s", &b), really?
I can learn this as "it's a rule", however I'd appreciate if someone helps me make sense of it.