C examples for Function:main function
It prints Hello and your name on the screen, if you specify your name as a command line argument.
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { if (argc != 2) { printf("You forgot to type your name.\n"); exit(1);//from www . j a v a 2 s.com } printf("Hello %s", argv[1]); return 0; }