Home / C Programming / C Preprocessor :: Discussion

Discussion :: C Preprocessor

  1. Point out the error in the program

      #include
      int main()
      {     
          int i;  
          #if A     
             printf("Enter any number:");          
             scanf("%d", &i); 
        #elif B   
          printf("The number is odd");       
       return 0;
     }
    

  2. A.

    Error: unexpected end of file because there is no matching #endif

    B.

    The number is odd

    C.

    Garbage values

    D.

    None of above

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    The conditional macro #if must have an #endif. In this program there is no #endif statement written.


Be The First To Comment