For a HW assignment I have to create a structure called Article
Contents are assigned at initialization levelCode:typedef struct
{
int number;
int quantity;
char description[STR_LEN+1];
} Article;
Print Article w/ Print() function (function gets address of the struct as a parameter)
I am trying to create a header file which defines the struct and print() function.
But I am confused on how I assign the pointer p to Article.Code:#ifndef PRINT_ART
#define STR_LEN 20
#define PRINT
typedef struct
{
int number;
int quantity;
char description[STR_LEN+1];
} Article;
void Print(struct Article *p)
{
(printf("(%d,%d,%s)/n", p.number, p.quantity, p.description);
}
#endif
I assume once I get this correct my cpp file would be main(), assign values to the struct members and call the print function.
Can anyone help my get this straight.
Thanks
scott

