Hi,
Please suggest me all possible ways of declaring structures in my C codes. I want to be able to create a structure which I can use in my methods without have to use the keyword "struct" each time to declare it. One way I already know of is :
typedef struct
{
char firstName[50];
char lastName[50];
}Person;
Creating it this way, I can use it in other methods like this (which is what I want, without using the struct keyword to declare) :
Person person1;
However, the problem I'm facing with this is that I can't get it to work when I want to create a member variable in the struct which is of it's own struct type. This is what I'm trying :
typedef struct
{
char firstName[50];
char lastName[50];
Person firstPerson;
Person secondPerson;
}Person;
And, obviously this doesn't compile. Would anybody please have a suggestion on how to accomplish this ?
As my question says, I'm still new to C. Please help !