C- Command Line Arguments

Home/Learn C Programming/C- Command Line Arguments
C- Command Line Arguments 2017-08-07T15:02:31+00:00

Command line arguments :

  • These are the parameters supplied to a program, when the program is invoked. This parameter may represent a file name that the program should process. Command line arguments are typed by the user. The first argument is always the file name.
  • We know that, every C program should have one main  function and it can take arguments like other functions. If we want to work with command line arguments, the main function can take 2 arguments called argc and argv and the information contained in the command line is processed onto the program through these  command line arguments.
  • The variable argc is an argument counter that counts No of arguments on the command line. The argument argv is an argument vector that represents an array of character pointers that points to the command line arguments. The size of this array is equal to the value of argc.



Prev Next