Examine program that echoes to the screen the first parameter after the program name:
#include <stdio.h> void main( int argc, char *argv[] ) { printf("Argument Count: %d\n", argc ); printf("First Param: %s\n", argv[1] ); }
Modify the program so it tests if there is at least one parameter after the program name.
Recall that the program name itself is counted by argc
so you need to test if argc
is at least two.