I understand that I can use structures to declare a group of variables of different data type:
struct acquaintance{
char name[10];
int year_met;
char activity_group:
};
But how do I proceed now? To learn structures I wish to do the following:
With a printf I ask the user name, year_met, activity_group. Example:
Ann 1992 dancing
Helen 1994 work
Bob 1881 skating
Then I want to create a function that calculates for how many years I have known the person, so I can learn how to pass structures to functions.
I don't know if this is a good example but I really need to learn structures and don't know how to create a good example that includes structures, arrays, pointers and functions.
Can someone guide me through this subject?
Thank you
struct acquaintance{
char name[10];
int year_met;
char activity_group:
};
But how do I proceed now? To learn structures I wish to do the following:
With a printf I ask the user name, year_met, activity_group. Example:
Ann 1992 dancing
Helen 1994 work
Bob 1881 skating
Then I want to create a function that calculates for how many years I have known the person, so I can learn how to pass structures to functions.
I don't know if this is a good example but I really need to learn structures and don't know how to create a good example that includes structures, arrays, pointers and functions.
Can someone guide me through this subject?
Thank you