What is the behavior of a union when different data types of different sizes are used?

  • It leads to a runtime error
  • It results in a compilation error
  • The union will have the size of the largest data type
  • The union will have the size of the smallest data type
In C, when different data types of different sizes are used in a union, the union will have the size of the largest data type. This allows you to store data of different types in the same memory location.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *