Interview Questions About C Programming – Unions
Q: Can you explain the concept of unions in C programming?Ans: In C programming, a union is a special data type that allows multiple data types to be stored in the same memory location. This means that a union variable can be used to store different data types at different times. However, only one of the members can be accessed at a time. Unions are defined using the keyword "union" and have the format:union union_name { data_type1 variable_name1; data_type2 variable_name2; ... }; For example, a union can be defined as follows:union Data { int i; char c; float f; }; This...
Read More