Home » C Programming » Structures » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    struct City
    {
    char *ch;
    };
    void main()
    {
    struct City c1;
    struct City *c2 = &c1;
    c2->ch = "Patna";
    printf("%s", c1.ch);
    }
    1. Compilation Error
    2. Garbage value
    3. Segmentation fault
    4. Patna
    5. None of these
Correct Option: D

Patna



Your comments will be displayed only after manual approval.