Typedef in structure declaration

typedef struct book
{
    int id;
    float price;
    char name[15];
}book;
book b1;
                                                                   OR
typedef struct
{
    int id;
    float price;
    char name[15];
}book;
book b1;
By using typedef keyword in our structure declaration we have eliminated the need to use struct keyword to declare a structure variable.

Without typedef we declared structure variable as 
 struct book b1;
With typedef we just declare structure variable as
book b1;

No comments:

Post a Comment