ProgrammingModerateTCS NQT · Infosys
int x = 2; int *p = &x; *p = *p * *p; What is x?
- A. 2
- B. 4
- C. 8
- D. 16
Correct answer: B. 4
*p * *p is 4, and the assignment stores 4 in x through the pointer.
More C Programming questions
- int (p)[5]; What is sizeof p / sizeof(int)?
- What does printf("%d", 7 % -3) print?
- int a = 7; printf("%d", a++ > 7); What is printed?
- For an int, what is the value of ~5 + 1?
- int x = 12; x = x ^ (x >> 2); What is x?
- Six people stand in a circle numbered 1 to 6; starting from 1, every second person is removed until one remains. Which number survives?…