> Sorry, I had in mind that I could declare local variables in any function but "main".
Thats a new one - most newbies just declare it wrong by saying it returns void.
The only 'special' rule for main is that you can't call it recursively - apart from that, its just like any other function.
> Is it OK then if I just declare the variable twice as local? I mean, I know it works, but is it correct?
Very correct.
> double LOA, I, J, P, E, D, GM, H1, H2, H3, S1, S2, S3;
Now to get rid of all these global variables, by putting the declaration inside new_project.
Code:
printf("\nLOA: ");
scanf("%lf", &LOA);
fprintf(output, "%.2f\n", LOA);
printf("\nI: ");
scanf("%lf", &I);
fprintf(output, "%.2f\n", I);
You only need one local variable here - since all you are doing is reading input, and writing it out to a file
Code:
double inputval;
printf("\nLOA: ");
scanf("%lf", &inputval);
fprintf(output, "%.2f\n", inputval);
printf("\nI: ");
scanf("%lf", &inputval);
fprintf(output, "%.2f\n", inputval);
> (except that the menu is displayed twice...
Because it still calls MENU();
It should just return to main, where it will fall out of the switch statement, then back round the while(1) loop into a call to MENU().