Home / C Programming / Pointers :: Discussion

Discussion :: Pointers

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

    #include stdio.h 
    
    int  main() {
    
       int *x;
    
       *x=100;
       return 0;
    
    }
    

  2. A.

    Error: invalid assignment for x

    B.

    Error: suspicious pointer conversion

    C.

    No error

    D.

    None of above

    View Answer

    Workspace

    Answer : Option C

    Explanation :

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


Be The First To Comment