What will be the output of following program with explanation is appreciated ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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; }

22nd Dec 2019, 8:34 PM
Iraz Irfan
Iraz Irfan - avatar
1 Answer
+ 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'
22nd Dec 2019, 8:58 PM
Bilbo Baggins
Bilbo Baggins - avatar