Rabu, 19 April 2017

How to use unions in c programming language

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 How to use unions in c programming language appeared first on Coding Security.


How to use unions in c programming language
read more

Tidak ada komentar:

Posting Komentar