0
What will be the output of following program with explanation is appreciated ?
#include <stdio.h> int main() { char *str="IncludeHelp"; printf("%c\n",*&*str); return 0; }
1 Resposta
+ 2
Starting from inside towards the outside, in the expression *&*str:
str is a pointer to a character, followed by other characters
*str is the contents addressed by the pointer str: the first character of the sequence
&(*str) is the address of that contents: it is the same than str; in fact & and * nullify themselves, because one is the inverse of the other
* &*str is equivalent to *str, it is the first character of the sequence pointed to by str; its value is 'I'