Basic and Advance C Question:
What is the correct declaration of main?
Answer:
There are two valid declarations:
int main(void)
int main(int argc, char **argv)
although they can be written in a variety of ways. The second parameter may be declared char *argv[] , you can use any names for the two parameters, and you can use old-style syntax:
int main()
int main(argc, argv)
int argc; char **argv;
int main(void)
int main(int argc, char **argv)
although they can be written in a variety of ways. The second parameter may be declared char *argv[] , you can use any names for the two parameters, and you can use old-style syntax:
int main()
int main(argc, argv)
int argc; char **argv;
Previous Question | Next Question |
What are pragmas and what are they good for? | Can you mix old-style and new-style function syntax? |