Answers for "how to read input from the command linein c"

C
0

read from command line c

#include <stdio.h>

int main(int argc, char **argv) {
    for (int i = 0; i < argc; ++i) {
        printf("argv[%d]: %s\n", i, argv[i]);
    }
}

/*
	[birryree@lilun c_code]$ ./a.out hello there
	argv[0]: ./a.out
	argv[1]: hello
	argv[2]: there
*/
Posted by: Guest on November-26-2020

Code answers related to "how to read input from the command linein c"

Code answers related to "C"

Browse Popular Code Answers by Language