Type Defined Structures In C Programming Language Made Easy

What is a Structures?

A struct in the C programming language (and many derivatives) is a composite data type declaration that defines a physically grouped list of variables to be placed under one name in a block of memory, allowing the different variables to be accessed via a single pointer.

the struct data type in C is similar to a class. The biggest difference between a struct and a class in these languages is that when a struct is passed as an argument to a function, any modifications to the struct in that function will not be reflected in the original variable.

Arrays allow to define type of variables that can hold several data items of the same kind. Similarly structure is another user defined data type available in C that allows to combine data items of different kinds.

Defining a Structure

We can use the keyword typedef to define a structure as follows:

The name student represents the structure definition associated with it and therefore can be used to declare structure variables as shown below:

1 COMMENT

  1. Hello there! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community in the same niche. Your blog provided us valuable information to work on. You have done a marvellous job!

Leave a Reply