for loop ignoring scanf inside loop
Logicially I think it's possible to have a scanf in a for loop. Am I wrong?
Here is the code that's ignoring the loop, I took out the parts that are not required to answer this question. When running the program choose 1 and then a number, between 3-10 should be sufficent:
Code:
int main()
{ // open main
int selection, amount, count;
int value;
printf("Welcome to the Cacluator of Statics of Materials\n\n");
printf("1. 2-D Resultant Force at a point.\n");
printf("Please choose a selection: ");
scanf("%d", &selection);
if(selection == 1)
{
printf("\nYou choose to calcualte a Resultan Force at a point.\n\n");
printf("Please insert the amount of Forces: ");
scanf("%d", &amount);
int forces[amount];
count = 0;;
for(count == 0; count < amount; count++)
{
printf("\nPlease insert the value of force #%d: ", count+1);
scanf("d", &value); // <---- This is being ignored why?
forces[count] = value;
}
}
else
{
printf("\nSelection Invalid! Please re-run the program.\n\n");
}
system("PAUSE");
} // close main