Home / C Programming / Declarations and Initializations :: Point Out Errors

C Programming :: Declarations and Initializations

  1. Point out the error in the following program (if it is compiled with Turbo C compiler).

    #include 
    int main() 
    {    
       display(); 
       return 0; 
    } 
    void display() 
    
    {    
       printf("Freshergate.com");
     
    } 
    

  2. A.

    No error

    B.

    display() doesn't get invoked

    C.

    display() is called before it is defined

    D.

    None of these

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Point out the error in the following program.

    #include 
    int main() 
    {    
     void v = 0;      
    
     printf("%d", v);     
    
     return 0; 
    
    } 
    

  4. A.

    Error: Declaration syntax error 'v' (or) Size of v is unknown or zero.

    B.

    Program terminates abnormally.

    C.

    No error.

    D.

    None of these.

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Point out the error in the following program.

    #include
     struct emp 
    {     
        char name[20];    
        int age;
     }; 
    int main() 
    {    
       emp int xx;   
       int a;     
       printf("%d\n", &a);    
       return 0; 
    }
    

  6. A.

    Error: in printf

    B.

    Error: in emp int xx;

    C.

    No error.

    D.

    None of these.

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Which of the following is correct about err used in the declaration given below?

     typedef enum error { warning, test, exception } err;

  8. A.
    It is a typedef for enum error.
    B.
    It is a variable of type enum error.
    C.
    The statement is erroneous.
    D.
    It is a structure.

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Point out the error in the following program.

    #include
     int main()
     {     
         int (*p)() = fun;   
         (*p)();    
         return 0; 
    } int fun() 
    {
        printf("Freshergate.com\n");  
       return 0;
    } 
    

     

  10. A.

    Error: in int(*p)() = fun;

    B.

    Error: fun() prototype not defined

    C.

    No error

    D.

    None of these

    View Answer

    Workspace

    Discuss Discuss in Forum