While I am writing my book in C programming I just learned for the first time how to write a program using Union in C. Here is a very simple program to demonstrate how to use union works.
I am currently accepting programming work, it projects, school
programming projects, thesis and capstone projects, IT consulting
work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
I am currently accepting programming work, it projects, school
programming projects, thesis and capstone projects, IT consulting
work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
My personal website is http://www.jakerpomperada.com
My personal website is http://www.jakerpomperada.com
Program Listing
#include <stdio.h>
union student
{
char name[200],subject[200];
int age;
float grade;
};
int main()
{
union student records;
printf("\n\n");
printf("\tUnion Sample Program");
printf("\n\n");
printf("\t===== DISPLAY RECORD =====");
printf("\n\n");
strcpy(records.name,"Juan Dela Cruz");
printf("\tStudent Name : %s\n ",records.name);
records.age = 17;
printf("\tStudent Age : %d\n ",records.age);
strcpy(records.subject,"Linear Algebra");
printf("\tStudent Subject : %s\n ",records.subject);
records.grade =89.03;
printf("\tStudent Grade : %.2f\n ",records.grade);
printf("\n");
printf("\tEnd of Program");
printf("\n\n");
}