Structures


  1. Which of the following is the correct output fot the program given below?
    #include <studio.h>
    int main ()
    {
    struct emp
    {
    char name[40];
    int age;
    float sal;
    };
    struct emp e = {"Ramu"};
    printf ("%d %f\n", e.age, e.sal);
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    When an automatic structure is partially initialised, the remaining elements of the structure are initialised to 0.

    Correct Option: A

    When an automatic structure is partially initialised, the remaining elements of the structure are initialised to 0.


  1. What will be the output of the code snippet given below?
    #include <studio.h>
    int main ()
    {
    struct book
    {
    char bookname[20];
    int totalpages;
    float price;
    };
    struct book b = {0};
    printf(("%d%f\n", b.totalpages, b.price);
    return 0;
    }









  1. View Hint View Answer Discuss in Forum

    When an automatic structure is partially initialised, the remaining elements of the structure are initialised to 0.

    Correct Option: A

    When an automatic structure is partially initialised, the remaining elements of the structure are initialised to 0.



  1. Which of the following structure declaration is incorrect ?









  1. View Hint View Answer Discuss in Forum

    We can not create structure variable until we know the size of structure.

    Correct Option: B

    We can not create structure variable until we know the size of structure.