Advertisement
dmilicev

command line arguments v1.c

Oct 3rd, 2019
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. /*
  2.  
  3.   Command line arguments: main(int argc, char *argv[])
  4.  
  5.   Compile program and run exe file like this:
  6.  
  7.   "command line arguments v1.exe" first second third
  8.  
  9. */
  10.  
  11.  
  12. #include <stdio.h>
  13.  
  14. int main(int argc, char *argv[])
  15. {
  16.     int i;
  17.  
  18.     printf("\n Number of command line arguments passed: %d \n", argc);
  19.  
  20.     for ( i = 0 ; i < argc ; i++)
  21.       printf("\n %d. command line argument passed is %s \n", i+1, argv[i]);
  22.  
  23.  
  24.     getch();    // to pause screen
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement