1

One of my career courses is teaching us the basics of "Turbo C". I was never sure if it was C or C++. So I checked the help and it said "Borland C++ Version 3.0".

But when I go look for help on the web, my code seems to be C.

So which one is it or why is it all mixed?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Emiliano Rodriguez
  • 454
  • 2
  • 6
  • 19

4 Answers4

4

You are able to compile C code with a C++ compiler, with minor changes to the code in some cases. So even if your code is C there is no problem that you are using Borland C++. It is even possible that the compiler will detect that it is a C file and apply different rules.

Philip Stuyck
  • 7,344
  • 3
  • 28
  • 39
3

To check what your compiler is doing, try this program:

int new;

int main() { return 0; }

If this compiles then you are using a C compiler; if not then you are using a C++ compiler. You may be able to control your compiler using compiler switches or by changing the extension of the file you are compiling.

M.M
  • 138,810
  • 21
  • 208
  • 365
2

The oldest compiler by Borland was "Turbo C". It had no C++ support. But later they added C++, so the compiler was renamed to "Turbo C/C++" and then to "Borland C/C++". All these compilers were backward compatible so sometimes people still refer to "Turbo C" while really speaking of Borland C++ etc.

BTW. Borland's compiler chooses "C" or "C++" mode depending on source file extension.

Matt
  • 13,674
  • 1
  • 18
  • 27
1

From Wikipedia:

In May 1990, Borland replaced Turbo C with Turbo C++.

The name "Turbo C" was not used after version 2.0, because with the release of Turbo C++ 1.0 in 1990, the two products were folded into a single product.

You will be able to directly use most C programs in C++ with just a few changes to the code. Most part of C is supported on C++.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Arun A S
  • 6,421
  • 4
  • 29
  • 43