what is the main use of structuresthe main


 

What is The main use of structures

The main use of structures is to lump together collections of disparate variable types, so they can conveniently be treated as a unit. For example, if we were writing a student record we might need for each identifier information like his name (a character array), his reg.no (an integer), and his address ( a character array).

i.e.

char name[15];

int regno;

char address[40];

We can make a structure out of this quite easily.  We first tell C what the structure will look like, that is, what kinds of things it contains; after that we can actually reserve storage for it, either in the same statement or separately.  The simplest thing is to define it and allocate storage all at once:

struct stud{

 student;

char name[15];

int regno;

char address

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: what is the main use of structuresthe main
Reference No:- TGS0305432

Expected delivery within 24 Hours