Question discussion

What is the output of the following code?

359043Medium DSSSB TGT Computer Science 0 replies 0 views
0
What is the output of the following code?
#include <stdio.h>
void func(void);
int main() {
    func(10);
    return 0;
}
void func(void)
{
    printf("Function called\n");
}
  • ACompilation error
  • BCompiles successfully but no output displayed
  • CPrints 'Function called'
  • DPrints 'Function not called'
Correct answer: A

Explanation

func is declared and defined to take no parameters (void), but it is called with the argument 10. This gives a compilation error (too many arguments).

Discussion 0

Nobody has replied yet. Start the discussion!