- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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++.
Example
#include<stdio.h> void myFunction() { printf("Function called\n"); } int main() { myFunction(); myFunction(2); }
Output
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.
Advertisements