I have read somewhere that if you create user defined data type like structure, the compiler will "give" the address of that structure (It the first element) to the name of the structure. struct person p1
, p1 will also hold it's address.
If this is true, why did this code not work ?
main(void) {
typedef struct personne{
char nom [20] ;
char prenom [15] ;
int age ;
char tel[12] ;
} personne ;
personne p;
p->age=10;
printf("%d",p->age);
}
ERROR MESSAGE: base operand of '->' has non-pointer type 'personne {aka main()::personne}'