πŸ“Š C Programming
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
πŸ’¬ Discuss
βœ… Correct Answer: (D) Compile error

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
268
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
82%
Success Rate