You are developing an application that needs to represent a value that could either be an integer or a floating-point number. How could you efficiently represent this data using C?

  • Using a linked list
  • Using a structure
  • Using a union
  • Using an array
In C, a union allows you to efficiently represent data that can be either an integer or a floating-point number, as it allows sharing the same memory location for different data types. Arrays, structures, and linked lists are not suitable for this purpose.
Add your answer
Loading...

Leave a comment

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