c - Difference between typedef struct and struct? -


i know basic difference between them have doubt in particular situation following:

struct books{     int id;     char* title;       }book;  book.id=9;    // valid; 

but in case of typedef :

typedef struct books{   int id;   char*title; }book; book.id=9;    //it not valid have book b1; b1.id=9 valid 

what going on here can u tell me?

in first case, creating object of type struct books named book.

in second, defining alias book type struct books. book not object type name.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -