click on this link......

LinkGrand.com

Wednesday 13 March 2013

Structure in C

Structure is grouping of variable under one name. Simple variable can be used to hold one piece of information at a time and arrays can be used to hold one element of the same data type. But structures can hold more than one element with different data types. Structure can contain integer, character, float, double arrays.

Syntax for structure definition:
struct strucure_name
{
             structure elements;
};

The keyword struct is used to define and declare structure.

Declaration of structure variable :
To create a reference of structure,  you can declare structure variable as follows.
struct structure_name variable_name;
To access structure variable, we have to use dot operator .
Syntax is 
struct variable.element name.
If you want to declare more than one reference of structure, you can use array with structure name.

Uses of structure:

1) changing the size of structure.
2) clearing the contest of the screen
3) placing the cursor at appropriate position on screen.
4) For drawing any graphical shape on the screen
5) Receiving a key from the keyword.
6) Checking the memory size of computer.
7) Finding out the list of the devices attached to the computer.
8) Formatting at floppy disk.
9) Hiding a file from the directory.
10) Displaying the directory of the disk
11) Sending the output to the printer.
12) Interacting with mouse.

No comments:

Post a Comment