A

Admin • 802.91K Points
Coach

Q. What is the output of this code?

Code:
#include <stdio.h>
void func(int* p) {
*p = 20;
}
int main() {
int x = 10;
func(&x);
printf("%d", x);
return 0;
}
  • (A) 10
  • (B) 20
  • (C) 0
  • (D) Error
  • Correct Answer - Option(B)
  • Views: 6
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin
The function modifies x via pointer dereferencing.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.