what is Structure,explain example of structure with program

Structure, example of structure with program


Structures

Collections of related variables (aggregates) under one name
Can contain variables of different data types
Commonly used to define records to be stored in files
Combined with pointers, can create linked lists, stacks, queues, and trees

Example

    struct card {
     char *face;
     char *suit; };
struct introduces the definition for structure card
card is the structure name and is used to declare variables of the structure type
card contains two members of type char *
These members are face and suit

Labels: