πŸ“Š C Programming
Q. Determine Output
Code:
void main()
{
      char *p;
      p="Hello";
      printf("%c", *&*p);
}
  • (A) Hello
  • (B) H
  • (C) Some Address will be printed
  • (D) None of These
πŸ’¬ Discuss
βœ… Correct Answer: (B) H

Explanation: * 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.

Explanation by: Rajeev Malhotra
* 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.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
158
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Rajeev Malhotra
Publisher
πŸ“ˆ
93%
Success Rate