Puzzle C4

Echo Two Parameters

Modify this program that echoes its first and second command line parameters after the program name if both exist, but echoes only the first if only it exists:

#include <stdio.h>
void main( int argc, char *argv[] )
{
  printf("Argument Count: %d\n", argc );
  
  if ( argc >=2 )
    printf("First Param: %s\n", argv[1] );
  else
    printf("No params after the program name\n");
}


Previous Page        Answer         Next Page         Home