I wrote code to store the Id and price of one product.
I want to extend the code to store so many id's and prices of products
I have following idea in mind for multiple products to their id's and prices
Hope somebody would help me
Code:
#include <stdio.h>
struct Product{
int id;
int price;
}product1;
int main()
{
/*Assigning id and pric of each product here*/
product1.id = 1;
product1.price = 30;
/* Displaying product details*/
printf("\n Product1 Id : %d", product1.id);
printf("\n Product1 Price : %d", product1.price);
return 0;
}
I want to extend the code to store so many id's and prices of products
I have following idea in mind for multiple products to their id's and prices
Code:
void ProductsDetails( Products, ID, Price)
void main()
{
ProductsDetails( 1, 0001, 30) //Call function from here
ProductsDetails( 2, 0002, 45)
ProductsDetails( 3, 0003, 60)
.......
ProductsDetails( Products, ID, Price)
}
Hope somebody would help me