
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
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.
- Related Articles
- C/C++ Function Call Puzzle?
- A C/C++ Pointer Puzzle?
- How to call a JavaScript function from C++?
- How to Call a Lua function from C?
- A C Puzzle in C Programming?
- A C Programming Language Puzzle?
- A Puzzle using C Program
- C/C++ Pointer Puzzle?
- Can main function call itself in C++?
- How to call a parent class function from derived class function in C++?
- JavaScript Function Call
- A Product Array Puzzle in C?
- A Boolean Array Puzzle in C?
- A Product Array Puzzle in C++?
- A Sum Array Puzzle in C++?

Advertisements