Consider the following code:
Code:
#include <stdio.h>
int main (int argc, char* argv[])
{
int i;
for (i = 0; i < argc; i++)
{
printf("%s %s\n", argv[i], argv[i]+i);
}
return 0;
}
Being new to programming, I am having a tough time in developing the right thought process in anayzing and writing functions with argument count and argument vector.
First of all, what are they used for? Is there any advantage in using argc and argv instead of the more commonly seen ones or are they used for specific purposes?
Second of all, the code above makes little or no sense to me. Is there a way to describe the loop above using a psuedocode? If so, please let me know the basic idea of the program above.
Lastly, why is there a star infront of the argv[]....that would make argv a double pointer wouldn't it? then argv[i] + i would be a pointer to an integer...I'm confused help!