c argv

www.l‮‬autturi.com
c argv

Argv represents the argument values
That is, the variable passed to the main function when the program starts executing.

#include <stdio.h>

int main(int argc, char *argv[]) {
	printf("%s\n", argv[0]);
	printf("%s\n", argv[1]);
    return 0;
}

For example, when we execute a program using the following command line

F:\hello.exe lautturi

will output:

F:\hello.exe
lautturi

argv[0] is the program name
argv[1] is the first parameter

Created Time:2017-08-22 14:05:45  Author:lautturi