Question: Say that I have this part of code. If user does not enter the file names as command line arguments I want to ask him again so as to enter them now but as it seems I cannot have access in argv[1] and argv[2]. For example when the first scanf is executed segmentation fault occurs. But in this case how can I read the arguments and place them into argv[1] and argv[2]?
Thanks in advance for your help!

```
int main (int argc, char **argv)
{
    if (argc != 3)
    {
        printf("You did not enter two files.\n");
        printf("You can now enter those two files.\n");
        printf("file 1: ");
        scanf("%s", argv[1]);
        printf("file 2: ");
        scanf("%s ", argv[2]);
    }

    printf("%s\n", argv[1]);
    printf("%s\n", argv[2]);

    FILE *file1 = fopen(argv[1], "r");
    FILE *file2 = fopen(argv[2], "r");
}

```

Answer: 
You don't. As the popular phrase goes, every problem in computer science can be solved by an extra layer of indirection. In this case the indirection is that you define a clean interface for opening a file and pass it a `char const*`. But this pointer doesn't have to be `argv[1]`.

You have to malloc your own buffer (because **none** exists) and write to it. Using `scanf("%s",...)` for this purpose will likely create a buffer overrun as you cannot know in advance how large your buffer needs to be.

*Edit*: Every single answer given to you suggesting to use `char buffer[NUMBER]` as the buffer for `scanf` **will blow up in your face**.
`Argv` is passed from console and you pass it while executing your program.

First, you have to compile it with, for example:

`gcc program.c -o program`

And then execute it with arguments, for example:

`./program arg1 arg2`

If you wish to wait for a user to enter parameters for your program through the console you should use regular variables.