Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct computer_part
{
char name;
int quantity;
int price;
};
int main()
{
struct computer_part cp[5];
int i;
for(i = 0; i < 5; i++) {
printf("enter price");
scanf("%d",&cp[i].price);
printf("\n %d",cp[i].price);
}
getch();
return 0;
}
I wouldn't use i without it first being given a value, and it's just confusing using %i as the format specifier, and i as the index to your cp array, right on the same line of code.
Maybe the above is what you wanted?