Multiple choice technology programming languages

Which of the following is not a valid declaration for main()?

  1. int main()

  2. int main(int argc, char *argv[])

  3. They both work

  4. None of the Above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Both 'int main()' and 'int main(int argc, char *argv[])' are valid declarations for main() in C and C++. The first is for programs without command-line arguments, the second for programs that need to process command-line arguments. Both are standard and correct.