Give the general syntax to initialize a structure to store a Book information

09 b] Give the general syntax to initialize a structure to store a Book information

After defining a structure format we have declare variables of that type. A Structure variable declaration is similar to the declaration of variables of any other data types.
It includes the following elements.

  1. The keyword struct.
  2. The structure tag name.
  3. List of variable names separated by commas.
  4. A terminating semicolon.

For example: syntax

struct book_bank book1, book2, book3;

declares book1, book2 and book3 as variables of type struct book_bank.

The complete declaration look like OR it can also be done like given below:

struct book_bank
{
  char title[20];
  char author[15];
  int pages;
  float price;
}book1, book2, book3;

Leave a Reply

Your email address will not be published. Required fields are marked *