C++ and C

Borland C++ escape sequences

Note: You must use \\ to represent an ASCII backslash, as used in operating system paths.

\a

0x07

BEL

Audible bell

\b

0x08

BS

Backspace

\f

0x0C

FF

Formfeed

\n

0x0A

LF

Newline (linefeed)

\r

0x0D

CR

Carriage return

\t

0x09

HT

Tab (horizontal)

\v

0x0B

VT

Vertical tab

\\

0x5c

\

Backslash

\'

0x27

'

Single quote (apostrophe)

\"

0x22

"

Double quote

\?

0x3F

?

Question mark

\O

 

any

O=a string of up to three octal digits

\xH

 

any

H=a string of hex digits

\XH

 

any

H=a string of hex digits

 

16-bit data types, sizes, and ranges

unsigned char

8

0 -- 255

Small numbers and full PC character set

char

8

-128 -- 127

Very small numbers and ASCII characters

enum

16

-32,768 -- 32,767

Ordered sets of values

unsigned int

16

0 -- 65,535

Larger numbers and loops

short int

16

-32,768 -- 32,767

Counting, small numbers, loop control

int

16

-32,768 -- 32,767

Counting, small numbers, loop control

unsigned long

32

0 -- 4,294,967,295

Astronomical distances

long

32

-2,147,483,648 -- 2,147,483,647

Large numbers, populations

float

32

3.4E -38 -- 3.4E 38

Scientific (7-digit precision)

double

64

1.7E -308 -- 1.7 E 308

Scientific (15-digit precision)

long double

80

3.4E -4932 -- 1.1E 4932

Financial (18-digit precision)

near pointer

16

Not applicable

Manipulating memory addresses

far pointer

32

Not applicable

Manipulating addresses outside current segment

 

32-bit data types, sizes, and ranges

unsigned char

8

0 -- 255

Small numbers and full PC character set

char

8

-128 -- 127

Very small numbers and ASCII characters

short int

16

-32,768 -- 32,767

Counting, small numbers, loop control

unsigned int

32

0 -- 4,294,967,295

Large numbers and loops

int

32

-2,147,483,648 – 2,147,483,647

Counting, small numbers, loop control

unsigned long

32

0 -- 4,294,967,295

Astronomical distances

enum

32

-2,147,483,648 -- 2,147,483,647

Ordered sets of values

long

32

-2,147,483,648 -- 2,147,483,647

Large numbers, populations

float

32

3.4E -38 -- 1.7 E 38

Scientific (7-digit) precision)

double

64

1.7E -308 -- 3.4E 308

Scientific (15-digit precision)

long double

80

3.4E -4932 -- 1.1E 4932

Financial (18-digit precision)

near (pointer)

32 bits

 

 

far (pointer)

32 bits

 

 

 

Q. Why don't printf() and puts() print text in color

in a DOS application?

A. Use the console I/O functions cprintf() and cputs()

for color output, as shown here:

#include <conio.h>

int main()

{

textcolor(BLUE);

cprintf("Hello, world!");

return 0;

}

 

Q. How do I print a long integer?

A. Use the "%ld" format:

long int l = 70000L;

printf("%ld", l);

 

Q. How do I print a long double?

A. Use the "%Lf" format.

long double ldbl = 1E500;

printf("%Lf", ldbl);

 

(1) In the statement:

a=30;

b=315;

c=272;

d=120;

z=a*a*a*a+b*b*b*b+c*c*c*c+d*d*d*d;

 

both z and a,b,c,d must be large enough to hold result of calculation.

a,b,c,d can not be of int data type. Type should be float.

 

(2) Miracle C is better than Borland C++!

Miracle C does not allow float c=n. Must be float c=n.0.

Compilation of float, double, and long double results in the same precision!

 



˅˅˅ Additional valuable information is available at one of the links below: ˅˅˅

 

Did you like the article? Let Google Search know by clicking this button: . Please link to content that you find useful on this website on your own website, forum or blog! You can also comment on this page below, or to ask a question or suggest a topic for me to research. There is a user-editable Wiki available on my website, as well as a Forum that you can contribute to. Site Map.

Page last modified 21-May-16 15:08:23 EDT
Comments on this page: