Hey so i am using Dev C++ compiler on Windows 7 and was programming a piece of code that is supposed to do the following -
Create a structure to store information about products for sale in a store. It should store information about the product name, the price, and the product number and then create an array of products called Inventory. Add five products to your inventory.
But for some reason, which is unknown to me, I always seem to get a complier error.
Any suggestions and input will be gladly taken
and this is what i have so far -
Code:#include<stdio.h> #include<stdlib.h> #include<string.h> struct product{ char name[30]; int product_number; double price; } void initProducts(); int main() { product inventory[5]; initProducts(inventory); printf("\n\n"); system("pause"); } void initProducts() { for(int i=0; i<5; i++) { printf("\n\nEnter the name of the product: "); scanf("%s", inventory[i].name); fflush(stdin); printf("\n\nEnter the product number of the product: "); scanf("%d", inventory[i].product_number); fflush(stdin); printf("\n\nEnter the price of the product: "); scanf("%f", inventory[i].price); fflush(stdin); } }