
HELP! user-defined data types
Quote:
> I am taking a home correspondence course in computer programming and I
> do not understand my text book on user defined data structures or data
> types. Could somebody please help me with some information and/or
> examples in c?
Hi Trish Minor,
Please try to be a bit more specific concerning what you want to
know and where your problems are. Maybe you could even try to
formulate a code sample to illustrate your problem.
Here is an example of a data structure in C:
struct address {
char name[100];
int age;
unsigned long amountOfMoneyYouOwnMe;
}
In this is how you declare a variable of that type and assign some
values to them:
int main( void )
{
struct address someGuy;
someGuy.age = 42;
someGuy.amountOfMoneyYouOwnMe = 4711;
strcpy( someGuy.name, "Marvin" );
return 0;
}
Stephan
(initiator of the campaign against grumpiness in c.l.c)