Home / C Programming / Typedef :: Point Out Errors

C Programming :: Typedef

  1. In the following code snippet can we declare a new typedef named ptr even though struct employee has not been completely declared while using typedef?

     typedef struct employee *ptr;
     struct employee
     {    
        char name[20];   
        int age;    
        ptr next; 
    } 
    

  2. A.

    Yes

    B.

    No

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Point out the error in the following code?

     typedef struct
     {    
         int data;   
         NODEPTR link; 
    }*NODEPTR; 
    

  4. A.

    Error: in *NODEPTR

    B.

    Error: typedef cannot be used until it is defined

    C.

    No error

    D.

    None of above

    View Answer

    Workspace

    Discuss Discuss in Forum