C   81

argument 1

Guest on 8th July 2022 05:35:09 PM

  1. #include <stdio.h>
  2.  
  3. int main( int argc, char *argv[] ) {
  4.         int i;
  5.  
  6.         printf( "argc:     %d\n", argc );
  7.         printf( "argv[0]:  %s\n", argv[0] );
  8.  
  9.         if ( argc == 1 ) {
  10.                 printf( "No arguments were passed.\n" );
  11.         } else {
  12.                 printf( "Arguments:\n" );
  13.  
  14.                 for ( i = 1; i < argc; ++i ) {
  15.                         printf( "  %d. %s\n", i, argv[i] );
  16.                 }
  17.         }
  18.  
  19.         return 0;
  20. }

Raw Paste


Login or Register to edit or fork this paste. It's free.