Sail E0 Webinar
Question


Point out the compile time error in the program given below.


#include<stdio.h>
int main()
{
int *x;
*x=100;
return 0;
}
Options:
A .  Error: invalid assignment for x
B .  Error: suspicious pointer conversion
C .  No error
D .  None of above
Answer: Option C

While reading the code there is no error, but upon running the program having an unitialised

 variable can cause the program to crash (Null pointer assignment).



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers