I'm trying to get the user argv and print in the screen the result. Here is my following code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (int argc, char *argv[])
{
if (argc >= 1)
{
char *command = "gcc ";
strcat(command, argv[1]);
printf("%s", command);
return 0;
}
}
It compiles, but every time I execute it says that "Windows stoped to work". Basically, if the user does:
myprogram.exe test
the output might be
gcc test
Where is my error?