C examples for Function:main function
Converts command-line argument to number
#include <stdio.h> #include <stdlib.h> /*ww w . j av a2s . co m*/ int main(int argc, char *argv[]){ int i, times; if (argc < 2 || (times = atoi(argv[1])) < 1) printf("Usage: %s positive-number\n", argv[0]); else for (i = 0; i < times; i++) puts("Hello, good looking!"); return 0; }