What is the difference between char *infile = argv[1]; and char infile = argv[1]; ?
What is the * used for?
Char declaration in C
It's a pointer. The second example does not make a lot of sense. You might do:
char infile = argv[1][0];
(for example) because you can apply one character from the argv[1] array to a char variable but you can't assign the entire argv[1] to a single character!
Note that argv is defined as one of:
int main(int argc, char * argv[]) {
or
int main(int argc, char ** argv) {
So argv is an array of char pointers. argv[1] is just one element of this so it is a "char *" not just "char".
And if you don't understand what I am talking about you have missed possibly the most important reason in the world why everyone chooses to write in C! Time to go back to your C book and read about pointers, address-of, pass by reference and other key C concepts).
What is the * used for?
Must be to denote a better way of coding.
In different contexts an asterisk might have a different meaning. But I'm surprised you don't have a C reference/primer of some type.
If you have not worked with pointers before, then start gently.
Not with pointers & array combinations but just simple pointer to simple variables.
Read a tutorial on pointers in general and experiment with some code.
(I haven't read anything from the link below, but cplusplus tends to have decent tutorials.
http://www.cplusplus.com/search.do?q=tutorial+pointer+
Then later add more complexity or more layers of indirection.
Pointers to functions are also a very nice concept and extremely usefull in some situations.