Home » Programming Tips & Tricks » C - Tips & Tricks

A funny trick to use C++ in C language program

By: IncludeHelp, on 29 JAN 2017

This is not a logical trick, this is a funny trick. Here we will lean how we can use C++ in a C language program?

Follow the given steps:

Step 1: Declare an integer variable with named "C".

Step 2: Assign the variable with 0.

int C=0;

Step 3: Now increase the value of C by using post increment operator.


Hence, you we can use "C++" in C programming language.

Here is the program:

#include <stdio.h>

int main()
	int C=0;
	printf("C++: %d\n",C++);
	return 0;


    C++: 1

Again I would say, this is not a logical program, we cannot use C++ concepts in C compiler, but we can use C language concepts in C++ program (compiler). The given program is just an example of variable declaration and post increment.

In this program we are just declaring and assigning a variable C with 0 and later, post increment operation is performing.

Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.

Comments and Discussions

We are using Google to publish ads on our website; Google has its own privacy policies. They may save log, cookies on your system. Google may also collect information of your system like IP address, region, city, country. For more details please go through the Google’s privacy policy.