What will be the output?
      char *p; 
      p = "Hello"; 

A. Hello

B. H

C. Some address will be printed

D. None of these.

Answer: Option B

Solution(By Examveda Team)

* is a dereference operator & is a reference operator. They can be applied any number of times provided it is meaningful. Here p points to the first character in the string "Hello". *p dereferences it and so its value is H. Again & references it to an address and * dereferences it to the value H.

Join The Discussion

Comments ( 2 )

  1. Satendra Chauhan
    Satendra Chauhan :
    5 years ago

    %cn .when n don't consider answer is a

  2. Amitkumar Pramanik
    Amitkumar Pramanik :
    5 years ago

    Answer should be Hn so d option should be correct

Related Questions on Pointer