Pointers

Q1: Point out the compile time error in the program given below.
#include<stdio.h>

int main()
{
    int *x;
    *x=100;
    return 0;
}

A Error: invalid assignment for x

B Error: suspicious pointer conversion

C No error

D None of above

ANS:C - No error

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).



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.