A C/C++ Function Call Puzzle?

We know that C and C++ are very much similar in different aspects. The C++ has additional object oriented feature in it, but most of the C programs can also be correct in C++. Here we will see one program related to function call, that can be run when it is written in C, but will not work in C++.


 Live Demo

void myFunction() {
   printf("Function called\n");
int main() {


Function called
Function called

This program will run in C and generates output, but when we want to compile in C++, it will return an error during compile time. It will say there are too many arguments are passed.

Updated on: 30-Jul-2019


Kickstart Your Career

Get certified by completing the course

Get Started