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

Computer & Maths Professor

Use #ifdef __STDC__command.
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

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

View 2 more Answers

Related Questions

Is C language the base for learning C++?
No. C and C++ are two different languages. All most all modern languages are influenced by C language. But we can learn C++ directly without learning C language.
Swathi
0 0
8
What is a macro, and how do you use it?
A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro. There are two kinds of macros. They differ mostly in what they look...
Sandeep
Why does execution of a program in C/C++/Java start from only main?
Main function is calling the other functions of he program and compiler gets this direction while Compiling the code. If it does not find main function then it will also not find the other functions in the code. So, main is required in C program.
Isha
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
What is the program for print calendar?
int fm(int date, int month,year) { int fmonth, leap; //leap function 1 for leap & 0 for non-leap if ((year % 100 == 0) && (year % 400 != 0)) leap = 0; else if (year % 4 == 0) ...
Yatindra

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

Ask a Question

Related Lessons

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...

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

What is a Programming Language
What is a Language? Language is a communication system of human. What is a programming Language? A programming Language is a formal constructed language design to communicate...

Everything about printf in C language
What is printf and from where it comes from in C code.? You must have used printf so many times in your Car programs but do you really know everything about printf? Let's see. What is the full form...

Static and dynamic libraries
A library is a package of code that is meant to be reused by many programs. A static library (also known as an archive) consists of routines that are compiled and linked directly into your program. When...

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