My question is about dereferencing a char pointer
Here is my code -
#define MAX 10
stackValue=&s;//here I assined the address of s to stackValue
printf("No place for Value");
printf("\n%s",*stackValue);//This doesn't work with * before it
printf("\n%s",stackValue);//This works properly
int i=10, *a;
printf("%d",*a);//this gives the value
printf("%d",a)//this gives the address
With the first code snippet:
stackValue=&s; is incorrect given
s is already an array to char. If you write like that then
stackValue becomes pointer to pointer to char (not pointer to char).
Fix that by changing to
%s expect a pointer to char (NOT pointer to pointer to char) - that explains why this doesn't work
printf("\n%s",*stackValue); // this doesn't work
With the second code snippet.
a=&i; is ok because
i is a single
int, NOT an array.