Structures in C programs-(with example & defination)

Structures in C programs :


Structures help to organize Complex data in a more meaningful way. It is a powerful concept that we may often need to use in our program design.
 Defining structure
 The structures must be defined first for their format that may be used later to declare structure variables. We can be fine after to hold this information as follows:
                                                struck book_bank
                                                {
                                                     char     title[20];
                                                     char     author[15];
                                                     int         pages;
                                                     float     price;
                                               };
 the keyword struct declares a structure to hold the details of a 4 data fields, namely title author pages and price. These fields are called structures elements or members. Each member may belong to different types of data. Book_bank  is the name of the structure and it's called the structure tag.
 In defining structures you may know the following :
 1. The template is terminated with a semicolon.
 2. The entire definition is declared as a statement, each member is declared independently         for its name and type in a separate statement inside the template.
 3. The tag name such as book_bank can be used to declare structure variables.

Post a Comment

0 Comments