Home » C Programming » Unions » Question
  1. In the following C code, we can access the 1st character of the string sval by using _______.
    #include <stdio.h>
    struct
    {
    char *Name;
    union
    {
    char *Str;
    } u;
    } tab[15];
    1. tab[i].u.Str[0].
    2. *symtab[i].u.Str
    3. Both tab[i].u.Str[0]. & *tab[i].u.Str
    4. You cannot have union inside structure
    5. None of these
Correct Option: C

Both tab[i].u.Str[0]. & *tab[i].u.Str



Your comments will be displayed only after manual approval.