Data Structure Using C Notes
About this eBook
contents only the core logic.
enum staff dept CSE, ISE, EEE, ENC, IEM,TE
char name 25 int basic enum staff dept dept stf
strcpy s.name, Koundinya s.basic 25000 s.dept CSE
printf n NAME s ,s.name printf n Salary s ,s.basic printf n Department s ,s.dept
1.4 Structure Today s application requires complex data structures to support them.
structure is a collection of related elements where element belongs to a different type. Another way to look at a structure is a template a pattern. For example graphical user interface found in a window requires structures typical example for the use of structures could be the file table which holds the key data like logical file name, location of the file on disc and so on. The file table in C is a type defined structure - FILE. Each element of a structure is also called as field. A field has a many characteristic similar to that of a normal variable . An arrary and a structure are slightly different. The former has a collection of homogeneous elements but the latter has a collection of heterogeneous elements. The general format for a structure in C is shown
struct field list variable identifier
struct struct name
type1 fieldname1 type2 fieldname2 . . . typeN fieldnameN