Home » C Programming » Structures » Question
  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. 0 0.000000
    2. Garbage values
    3. Erroe
    4. None of the above
Correct Option: A

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



Your comments will be displayed only after manual approval.