Reputation: 55
I have some problems with this code:
typedef struct Product {
char product_code[5];
int sells;
int sells_quantity;
}p[3];
typedef struct Seller {
char seller_code[5];
Product *ptr;
}seller[5];
Why does it give me an error for Product *ptr
?
Upvotes: 0
Views: 232
Reputation: 194
You can do this :
typedef struct Product {
char product_code[5];
int sells;
int sells_quantity;
}p[3],Product;
typedef struct Seller {
char seller_code[5];
Product *ptr;
}seller[5];
Upvotes: 0
Reputation: 1006
Could you try replace your code
typedef struct Product {
char product_code[5];
int sells;
int sells_quantity;
}p[3];
With
typedef struct Product {
char product_code[5];
int sells;
int sells_quantity;
} Product; // from here the structure type Product is recognized by the compiler.
Upvotes: 1