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.

C++;

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

Here is the program:

#include <stdio.h>

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

Output

    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.





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.