247 views
0 votes
0 votes

 02.  main ( )

        {

            char *P;

            P = “hello”;

            printf (“%c”, *&*P);

        }

        What will be the output of the above code?

 

        (A) h        (B) e      (C) l               (D) o

Ans: (A)

How ans A came..please explain

1 Answer

1 votes
1 votes
option(A) is correct

p is a pointer pointing to the given string " hello"

let the base address of string is 100 so pointer p will contain 100 and characters of string "hello" will be at 100(h) ,101(e),102(l),103(l),104(o),105(\0)

*&*P=*(&(*P))) accorging to associativity because precedence of all is same

*P=>value at 100 =>h

&h=>100

*(100)=>h

Related questions

0 votes
0 votes
0 answers
4
saurabh111 asked Nov 2, 2018
239 views
in char data type ,plzzz tell me initilization can be seprated from declaration..