#Why c99 mode ?
16 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
Are you done writing?
no error
eh
I mean code with if (int) when run will appear c99
examples
#include <stdio.h>
#define daily_calorie_limit 2000
int main(){
int number_of_meals = 3;
float calories, total_calories = 0;
// Title
printf("\n=== Daily Calorie Counter Program ===\n");
printf("This program will calculate the total daily calories consumed\n");
// Input
for(int a = 1; a <= number_of_meals; a++ ){
printf("Enter the calories for meal number: %d\n", a);
scanf("%f", &calories);
total_calories += calories;
}
printf("\nTotal calories: %.0f\n");
if(total_calories > daily_calorie_limit){
printf("Total calories exceed the daily limit");
}
else{
printf("Total calories are within the daily limit");
}
return 0;
}
Not much to add really.
If you want to introduce new variables within the scope of your function then you must use C99 or later.
Your compiler appears to default to C89.
Does this depend on the specifications of the computer?
No, it's nothing to do with the hardware.
Just configure your project / makefile to use the C99 standard or later.
Unless your compiler is so old that it only understands C89....
I don't know what build system you may be using.
Look around for a tab / page containing compiler settings and look for drop down options where you select the C standard.
Or perhaps there is a free-form field for "additional compiler options" or words to that effect where you can type "-std=c99".
I mean the compiler advertised itself as willing to support c99, although I smell some ancient mingw
as nowadays it defaults to C17
not sure what part that Falcon thing plays here in the picture