Introduction to Structure Structure is a user-defined datatype in C language which allows us to combine data of different types together. Structure helps to construct a complex data type which is more meaningful. It is somewhat similar to an Array, but an array holds data of similar type only. But structure on the other hand, can store data of any type, which is practical more useful. For example: If I have to write a program to store Student information, which will have Student's name, age, branch, permanent address, father's name etc, which included string values, integer values etc, how can I use arrays for this problem, I will require something which can hold data of different types together. In structure, data is stored in form of records . Defining a structure struct keyword is used to define a structure. struct defines a new data type which is a collection of primary and derived datatypes. Syntax: struct [ structure_tag ] { //me...
Comments
Post a Comment