#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; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter