Skip to main content

Command Palette

Search for a command to run...

What are structures in C?

It's a short first step towards the understanding of structures in C.

Updated
•1 min read•View as Markdown
What are structures in C?

Characteristics of structures are :

  • The data type of the elements stored in the structures can be the same or different depending on the user.

  • The structure is basically a group of related elements.

  • Structures are totally user-defined data types.

as we all know elements in arrays need to be of the same data type actually they must be of the same type or otherwise they won't be called arrays. Structures consist of elements which are also known as fields now each element or field also has a name and data type (int, char, etc..).

The example below will define the structures in a better way for finer understanding:

snip of struct 2.png

In the image above "struct" is a composite data type declaration which shows that this group of variables is stored in a block of memory under one name (which is "employee" in the above example) and you can also see how well defined data type and element are defined in the image above.

More from this blog

Tech Savvy & Budget-Conscious: Reviews & Hacks for Students

39 posts