Multiple choice technology programming languages

What is the return type of main() ?

  1. void

  2. int

  3. char

  4. long

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

In C and C++, main() returns int by default. The return value indicates the program's exit status (0 for success, non-zero for error). While some compilers allow void, the standard specifies int as the return type.