char *a = "bla"
a : a char* , and you should use %s for printf(...) ;
a[1] equivalent to *(a+1) , then a[1] is char , and you should use %c for printf(...) ;
&a[1] equivalent to &(*(a+1)) , then &a[1] is char* , and you should use %s for printf(...) ;
This is more like a pointer question. To better understand how pointers work, think like this:
char *j;
j is char*
*j is char and is equivalent to j[0]
*(j+1) is char and is equivalent to j[1]
&(*j) is a char* and equivalent with &j[0] equivalent to j
&j is char**
Another example:
char j**
j is char**
*j is char*
**j is char and is equivalent to *(*(j+0)+0) and is equivalent to j[0][0]
&j is char***
etc.
source share