C Structure

What is structure?

  • Structures (also called structs) are a way to group several related variables into one place.

(স্ট্রাকচার হল একাধিক সম্পর্কিত ভেরিয়েবলকে এক জায়গায় গোষ্ঠীবদ্ধ করার একটি উপায়।)

  • Unlike an array, a structure can contain many different data types (int, float, char, etc.).

  • Structure 2 types: Global Structure, Local Structure.

Syntax

Global Structure:

Use the struct keyword inside the main() method, followed by the name of the structure and then the name of the structure variable:

Example :

Output:

What is union?

  • Same as structure.

  • Union store data highest memory size variable memory.

Syntax

Example :

Output:

  • See The video for better learn.