Answer the question
In order to leave comments, you need to log in
How to pass arguments before compilation, where can I find a program that does not compile itself, but waits for user input?
int main(int argc, char argv[])
{
if (argc != 2) {
printf("ERROR!");
}
else {
printf("OK!");
}
system("pause");
}
Answer the question
In order to leave comments, you need to log in
If you need to achieve ERROR or OK output, then these are the launch arguments.
The launch arguments have nothing to do with compilation.
You can run an exe file of an already compiled program with arguments (for example, via CMD).
In the IDE through which you compile and run, you can set the launch arguments (launch options, command-line arguments, something like that).
You completely misunderstand the terms "compilation", "execution", etc.
And because of this, you ask about the same questions in new topics ... to which you still won’t get answers.
As soon as you understand the process of making code in the C language, everything will go right away. ;-)
PS In general, the best way to deal with C programming is to forget about Windows, VisualStudio and the like, and study only on Linux ... at least in a virtual machine.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question