The reason you're having trouble is that main
must have a specific form or it will not compile. You can't use something different.
If there will be no parameters passed to the program, it must look like one of the following:
int main()
int main(void)
Either is acceptable, but the latter is considered to more formally say that there are no parameters expected.
If your program takes parameters, it MUST have the following form:
int main(int argc, char* argv[])
This is the required standard and can't be changed. argc and argv usage is predefined in C. The first argument, argc, is a count of the number of elements in the array argv[]. The first element in the array, or argv[0], is the program name as it was invoked. Each element after that will contain the parameters from the invocation of the program, in order. So, if you have a program that is executed with the following line:
./testprog alpha 1 15 yes
Then argc=5, argv[0]=./testprog argv[1]=alpha argv[2]=1 and so on. Also, remember that every element in argv is a string. If you need to use one as a number, you need to use the appropriate function, like atoi() to convert it to the appropriate number type.
If this answers your question, please accept this answer to remove the question from the unanswered question pool. Let's keep up on forum housekeeping. ;-)