Unions have the same syntax as that of a structure since both of them are similar. However, there is a major difference between them in terms of memory allocation. A structure is allocated memory for all the members of the structure whereas a union is allocated memory only for largest member of the union. This implies that, although a union may contain many members of different types, it can handle only one member at a time. Like structure, a union can be declared using the union keyword as shown below: 1 2 3 4 5 6 union student { char
The post What is the use of UNION keyword in C programming appeared first on Coding Security.
What is the use of UNION keyword in C programming
read more
Tidak ada komentar:
Posting Komentar