A

Admin • 833K Points
Coach

Q. Pick the best statement for the following C program snippet:

Code:
#include <stdio.h>

int main()
{
int var; /*Suppose address of var is 2000 */

void *ptr = &var;
*ptr = 5;
printf("var=%d and *ptr=%d",var,*ptr);

return 0;
}
  • (A) It will print “var=5 and *ptr=2000”
  • (B) It will print “var=5 and *ptr=5”
  • (C) It will print “var=5 and *ptr=XYZ” where XYZ is some random address
  • (D) Compile error
  • Correct Answer - Option(D)
  • Views: 18
  • Filed under category C Programming
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.