O
O
OccamaRazor2016-09-25 17:38:07
Programming
OccamaRazor, 2016-09-25 17:38:07

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

2 answer(s)
G
GavriKos, 2016-09-25
@GavriKos

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).

O
Oleg Tsilyurik, 2016-09-25
@Olej

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 question

Ask a Question

731 491 924 answers to any question