Reads commandline items by using arguments to main() - C Function

C examples for Function:main function

Description

Reads commandline items by using arguments to main()

Demo Code

#include <stdio.h>

int main(int argc, char *argv[]){
    int count;// www .  j  a  v  a 2 s.co m
    
    printf("The command line has %d arguments:\n", argc - 1);
    for (count = 1; count < argc; count++)
        printf("%d: %s\n", count, argv[count]);
    printf("\n");
    
    return 0;
}

Related Tutorials