C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

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.

Liked this article? Do share with your friends :)