What are the values of
char a,b;
b="this is a character";
a=&b
What will be the value of ***a, **a, and *a? How? Are there any good examples for the above?
What are the values of
char a,b;
b="this is a character";
a=&b
What will be the value of ***a, **a, and *a? How? Are there any good examples for the above?
I think you mean:
char *a,*b;
b="this is a character";
a=&b;
using something like
printf("***a = %d, **a = %d, *a = %d ", ***a, **a, *b);
char a,b;
b="this is a character";
a=&b
line 2: You are assigning a char* to a char. This will generate an error.
line 3: You doing the same thing in line three. Perhaps you meant to declare b as a char*?
Assuming that b is a char*:
***b will dereference to 't', then will generate an error for trying to dereference a char.
Same for **b. *b will result in 't'.
It seems you missed some stars.
char **a,*b;
b="this is a character"; // 't' is the first character
a=&b;
In this case *a is the b variable, **a (or *b) is the character t and ***a is a compilation error.
I read C 6 years ago. Still my statements can answer your question.
in case of a=&b, a is storing b's location in memory. So *a returns value of b. But **a will treat b's value as memory address. And will return the value of memory block having the address equals to b's value. And so on.