Home » C Programming » Structures » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    struct Country
    {
    char *name;
    };
    struct Country function(void)
    {
    struct Country cnt1;
    cnt1.name = "India";
    return cnt1;
    }
    void main()
    {
    struct Country cnt2 = function();
    printf("%s", cnt2.name);
    }
    1. India
    2. Compilation Error
    3. Garbage value
    4. Nothing
    5. None of these
Correct Option: A

India



Your comments will be displayed only after manual approval.