UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

How can you tell whether a program was compiled using C versus C++?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

Teacher 4 You

use _LINE_
Comments

VBA/Excel/Access/SQL Server

The code below contains standard, pre-defined macros used at runtime to determine whether a C or C++ compiler was used to compile the code. For C compilers, it also determines the version of the C language standard that the compiler implements). #ifdef __cplusplus printf("C++ compiler\n"); #else #ifdef...
read more
The code below contains standard, pre-defined macros used at runtime to determine whether a C or C++ compiler was used to compile the code. For C compilers, it also determines the version of the C language standard that the compiler implements). #ifdef __cplusplus printf("C++ compiler\n"); #else #ifdef __STDC__ #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) ||/*continue.. ...on the next line */ (defined(__GNUC__) && !defined(__STRICT_ANSI__)) printf("ANSI X3.159-1999 / ISO 9899:1999 (C99) compiler\n"); #else printf("ANSI X3.159-1989 (C89) / ISO/IEC 9899:1990 (C90) C compiler\n"); #endif #else printf("Pre-ANSI (K&R) C compiler\n"); #endif #endif or The code below determines whether a C or C++ compiler was used to compile the code at runtime: if (sizeof('c') != sizeof(int)) printf("C++ compiler\n"); else if ((unsigned char)1 < -1) printf("Pre-ANSI (K&R) C compiler\n"); else { int i; i = 1 //* */ +1; if (i == 2) printf("ANSI X3.159-1999 / ISO 9899:1999 (C99) compiler\n"); else printf("ANSI X3.159-1989 (C89) / ISO/IEC 9899:1990 (C90) C compiler\n");} read less
Comments

Many ways On Unix/Linux: 1. type nm executable name, if it show some funny names that means it is mangled C++ 2. type ldd executable name, it will show dependency libraries and if it shows C++ libraries then it is C++ code
Comments

Computer & Maths Professor

Use #ifdef __STDC__command.
Comments

View 2 more Answers

Related Questions

Basics of 'C'language
C is middle level language, using C you can write program which directly interact with the hardware like device driver programming or you can write GUI application. C is very powerful language compare...
Raghavendra
I’ve been learning C language for 3 weeks but it’s becoming more difficult. As a result, I’m becoming lazy. What should I do to motivate myself?
Learn algorithm or flowchart first. Once you start C, try to relate with real time example. Example: When learn printf() , think about a a bill where you customer information is printed. Similarly when...
Akhilesh
0 0
5
Why should I learn Python over C or C++?
There are definite differences. C++ is a strongly typed language and Python is not. There's no need to declare variables. ... (I generally don't like languages to be dependent on any kind of formatting,...
Sajini
When is a "switch" statement better than multiple "if" statements?
switch statement is generally best to use when you have more than two conditional expressions based on a single variable of numeric type. For instance, rather than the code if (x == 1) printf(“x...
Shalu
In Java programming, what are the differences between the functions of 'int' and 'int []' when working with an array?
The may appear as part of the type at the beginning of the declaration, or as part of the declarator for a particular variable but But int a keeps type information together and is more verbose so I prefer it.
Kalpana
0 0
5

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Recursion in C Programming
The process of calling a function by itself is called recursion and the function which calls itself is called recursive function. Syntax of Recursive Function returntype recursive_func () { statements; ...
R

Ravindra Yadav

2 0
0

Compiler vs Interpreter
Compiler Interpreter Convert all the code into binary format and execute. Convert one statement at a time and execute, then Convert next statement and execute. After conversion, source...

Programing Languages Learning Tricks
You want to learn that new language or library or framework as soon as possible, right? That’s understandable. Fortunately, there are a handful of tips that can help you to better retain all of that...

Harshal G.

0 0
0

Array vs Linked List
Array Linked List Accessing element is easy. Accessing element is difficult compare to Array. Easy to use. Difficult to use. Memory is Fixed size. Memory is variable size. If...

Features Of C Language
Features of C language It is a robust language with rich set of built-in functions and operators that can be used to write any complex program. The C compiler combines the capabilities of an assembly...

Recommended Articles

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more