unions

PHOTO EMBED

Thu Jun 09 2022 18:15:11 GMT+0000 (Coordinated Universal Time)

Saved by @KanishqJ8

#include <string.h>
union student{
    int id;
    int marks;
    char name[34];
};

int main(){
    union student s1;
    s1.id=1;
    strcpy(s1.name,"harry");
    s1.marks=45;
    
    printf("the id is %d\n",s1.id);
    printf("the marks are %d\n",s1.marks);
    printf("the name is %s\n",s1.name);
    return 0;
}
content_copyCOPY