Halo all,
I started reading command line arguments from K&R. But frankly speaking I didn't get even a single word of it. Forget about command line arguments, What is a "command line"? Then I started going through some tutorials over the net on this topic but still much much confused about what they are?
Where they are useful? After that I saw a code in some site
Code:
#include <stdio.h>

int main(int argc, char *argv[])
{
  int i;
	printf("Program name: %s\n", argv[0]);
  
  for(i = 1 ; i<argc ; i++)
    printf("\nArgument %d: %s", i, argv[i]);
  return 0;
}
The output gives me the path of my file.
I commented out the following lines and the output was unchanged
Code:
 for(i = 1 ; i<argc ; i++)
    printf("\nArgument %d: %s", i, argv[i]);
Then what's the use of these lines more specifically of argv[i].
And yes please tell me without any reference to files because I haven't studied them yet. Also if possible please show me a code where command line arguments are easy to understand.
Thanks