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

How to enroll for the course?
register here then post your requirements,do provide your ph no by which trainers can contact you or you can individually search for trainers nearest to your location and contact them.
Alpana
What is a calling function in C?
Calling function is the one where the function call has been made and after executing the called function, control returns to the calling function.
Gowre
0 0
5
Can a function defined inside another function?
No, you can call other function(s) inside a function but you cannot define a new function in it.
Kamal
0 0
8
Is it necessary to mention the header files in the C programming language?
yaa !!!!! it is necessary because we need the data present in evey header file...like example we can do mathematical calculations with the help of math header file.
Hari
How do we print something, e.g. my name, in C language without using the printf function?
int main() { char str1; char str1; strcpy (str1,"tutorialspoint"); strcpy (str1,"compileonline"); puts(str1); puts(str1); return (0); } Compile and run the above program to produce the following result tutorialspoint compileonline
Praveen
0 0
6

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

Ask a Question

Related Lessons

C, Cpp, Java, Python, Javascript Programming Languages
Learning C is as good as Learning a Natural Language(such as English, Hindi, Telugu, Tamil etc) We use Natural Languages to communicate with humans whereas we use Programming Languages such as C, Cpp,...
V

Vamshi

0 0
0

Swapping variable contents using C
/* WAP to swap the content of variables using C*/ //Header files #include<stdio.h>#include<conio.h> //Main function void main(){ //Variable declaration of type integer int a,b,c; //function...
S

Java and C trainer
Always think any conspect with real-time example like Object -- object must have states and behaviour then only we will call that thing is Object like fan is Object (rotating,color)

Datatypes in C Language
Data types in C Language Data types specify how we enter data into our programs and what type of data we enter. C language has some predefined set of data types to handle various kinds of data that...

All About Programming And A Good Programmer.
Hi, This is my first lesson for you guys. Hope you enjoy reading it. In recent community questions, I found many people wanted to be good programmers, or wanted to have good hands on certain language,...

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 >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

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