Multiple choice technology programming languages

What the following program is executed? void main() { void ptr = (void) malloc(sizeof(void)); ptr++ ; }

  1. CompilationFails

  2. Will Throw RunTime Error But Code will get Compiled

  3. Throws Linker Error

  4. All the above statements are invalid

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

sizeof(void) is invalid in C and C++ - void is an incomplete type with no defined size. The malloc call will fail to compile because you cannot determine the size of void.