[ back to toc ]

structures

Date: 2002/04/07 13:26

Q:
hello

i have a problem with structures.i have this example that i need help from
and it is as follows:

typedef struct
{
float price;
float quantity;
}VALUE;

typedef struct _record
{
char code[10];
VALUE figure;
struct _record *next;
}RECORD;

they gave the function of printing the code as:
void print_code (char *code)
{
printf(" %s\n ", code);
}
and then gave a function of printing all the codes as:
void list_all_codes (RECORD *rptr)
{
print_code ("CODE: ");
while (rptr)
{
print_code (rptr->code);
rptr = rptr->next;
}
}

QUESTION
my question is how to write the function declaration that will print all
the prices and quantities.

A:
What you need is

rptr->figure.price

and

rptr->figure.quantity

regards,
Peter

[ back to toc ]