Difference Between Structures and Unions in C Programming

Structure variables can be declared while

  • While defining the structure
  • After defining the structure
  • Using typedef

Structure variables can be initialized while

  • Creating the structure variables
  • After creating the structure variables
  • By using structure element names like any other variable names

Union variables can be declared while

  • While defining the Union
  • After defining the Union
  • Using typedef

Union variables can be initialized while

  • Creating the Union variables
  • After creating the Union variables
  • By using Union element names like any other variable names
Translate ยป