Hello, I have been using sublime text for a good while now, though only really for html and css work. After switching to Linux Mint as a Windows 10 refugee, I decided to use sublime text for C and Python editing as well.
Building C files has been producing some strange behaviours. I have been using the “C single file - run” build system. The build system seems to run, and looks like it works fine if there are no scanfs in a program. If I do put a scanf in a program, it seems to run everything in the wring order.
This is my code:
#include <stdio.h>
int main()
{
int var;printf(“the program is now asking for input, the inputted number is expected to come after this colon: “);
scanf(”%d”, &var);printf("\ni have entered %d, and now another input is asked for, which will be stored in the same variable: “, var);
scanf(”%d", &var);printf("\n\nthe correct number is here: %d, so the code technically functions the same\n", var);
return 0;
}// end main
and the output looks like this:
3
1
the program is now asking for input, the inputted number is expected to come after this colon:
i have entered 3, and now another input is asked for, which will be stored in the same variable:the correct number is here: 1, so the code technically functions the same
[Finished in 2.6s]
The code functionally works, but with my testing, I have deduced that the build system seems to ask for input, and only then run the program, and call the inputs in order. My question is, is there any way to have the scanfs call in real time, and not before the programs runs?