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

What is the difference between text and binary modes?
By default files are text mode. Binary modes are machine readable form.
Raj
What is the structure of a C program?
A C program typically starts with preprocessor directives, followed by global variable declarations. It then defines functions, one of which must be the main() function, serving as the entry point. The...
Igno
0 0
5
The object file is in binary code, and the machine understands the binary language. So why object files are not executed?
Object files are sources compiled into binary machine language, but they do not have library files, so they are not executed.
Dhruvil
0 0
9
What is a local block in C programming?
the statements within the braces { } is known as local block
Rakhi
0 0
6
Is C programming and embedded C the one and the same?
in c language only u can learn c language concepts but in embeded c u can learn the in depth knowlege on c and embeded for machinelearning purpose i prefered to learn embeded c
Yogesh
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

Is It Fine To Write “void main()” Or “main()” In C/C++?
The definition: void main() { /* ... */ } Is not and never has been C++, nor has it even been C. See the ISO C++ standard 3.6.1 or the ISO C standard 5.1.2.2.1. A conforming...

Creating First Program Using C Language
Step 1: Install and setup Turbo C compiler on your computer. Step 2: Open Turbo C from your Desktop or Programs menu. Select “File” from menu bar and select option “New”. Step...

Bit wise operators in C
Bit Wise Operators Bit Wise operators are manipulates of individual bits with in a word of memory. The bit wise operators can be divided in to three general category. One’s Complement...

C++ Program-Working with constant using #define preprocessor
//Header Files #include#include // using #define preprocessor for defining a constant#define len 10#define br 5#define rad 3#define NEWLINE '\n' //Main function void main(){ int area_r; float area_c; //Function...
S

C Program-String Comparison
// WAP to compare strings entered by the user //Header files #include<stdio.h>#include<conio.h>#include<string.h> //Main function void main(){ char str1; char str2; int comp; //Function...
S

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