Author Topic: Bool data type - converting the code from VC++ to Turbo C or Turbo C++  (Read 2081 times)


  • Administrator
  • Full Member
  • *****
  • Posts: 69
bool is a primitive data type (like int, float, etc) which is avilable in C++ for windows that is Visual C++. it can take only two values true and false (1 and 0).
Turbo C / C++ ver 3.0 for DOS does not offer bool primitive data type.

When converting the code from VC++ to Turbo C++ or Turbo C, the bool data type is not supported. Either you have to make changes all over the source code by changing bool to int in Turbo C code. Instead you can use simulated code like "enum" data type "bool" in Turbo C so that we do not have change the whole code.
Here is the example
enum _boolean {
    true = 1, false = 0,
Even then when I am using the above enum, I have to type "enum _boolean" instead I can use typedef. so that I can just type "bool" (as if in VC++) which is equal to "enum _boolean"
enum _boolean {
    true = 1, false = 0,
} bool;


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1