C Numeric Integer Floating-point Variable Types Small Large integers floating-point values character Short Long integer Unsigned short long integer single Long double floating-point C provides several different types of numeric variables because different numeric values have varying memory storage requirements

Data Recovery PRO DATA DOCTOR

Home | Order Online | Downloads | Contact Us | Software Knowledgebase

it | es | pt | fr | de | jp | kr | cn | ru | nl | gr


Numeric Variable Types

C provides several different types of numeric variables because different numeric values have varying memory storage requirements. These numeric types differ in the ease with which certain mathematical operations can be performed on them.

Small integers require less memory to store, and your computer can perform mathematical operations with such numbers very quickly. Large integers and floating-point values require more storage space and more time for mathematical operations. By using the appropriate variable types, you ensure that your program runs as efficiently as possible.

C's numeric variables fall into the following two main categories:

  • Integer variables
  • Floating-point variables

Within each of these categories are two or more specific variable types. Table given next, shows the amount of memory, in bytes, required to hold a single variable of each type.

The type char may be equivalent to either signed char or unsigned char, but it is always a separate type from either of these.

In C there is no difference between storing characters or their corresponding numerical values in a variable, so there is also no need for a function to convert between a character and its numerical value or vice versa. For the other integer types, if you omit signed or unsigned the default will be signed, so e.g. int and signed int are equivalent.

The type int must be greater than or equal to the type short, and smaller than or equal to the type long. If you simply need to store some values which are not enormously large it's often a good idea to use the type int; it usually is the size the processor can deal with the easiest, and therefore the fastest.

With several compilers double and long double are equivalent. That combined with the fact that most standard mathematical functions work with type double, is a good reason to always use the type double if you have to work with fractional numbers.

The following table is to better describe the variable types:

Variable Type

Keyword

Bytes Required

Range

Format

Character

char

1

-128 to 127

%c

Integer

int

2

-32768 to 32767

%d

Short integer

short

2

-32768 to 32767

%d

Long integer

long

4

-2,147,483,648 to 2,147,438,647

%ld

Unsigned character

unsigned char

1

0 to 255

%c

Unsigned integer

unsigned int

2

0 to 65535

%u

Unsigned short integer

unsigned short

2

0 to 65535

%u

Unsigned long integer

unsigned long

4

0 to 4,294,967,295

%lu

Single floating-point

float

4

-3.4E38 to 3.4E38

%f

Double floating-point

double

8

-1.7E308 to 1.7E308

%lf

Long double floating-point

long double

10

-1.7E4932 to 1.7E4932

%Lf


Sample Chapters from book DATA RECOVERY WITH AND WITHOUT PROGRAMMING by Author Tarun Tyagi
Data Recovery with & without Programming


Publishers of the Book
Number of Pages
ISBN
Price of the Book


BPB Publications, New Delhi, India
540
81-7656-922-4
$69.00 (Including Shipping Charges, Cost of Book and Other expenses, Free Source Code CD included with the Book)





Buy Data recovery Book

Previous page

page 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20

 
 

page 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37

 
 

page 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54

 
 

page 55 | 56 | 57 | 58 | 59 | 60

Next page

© Copyright 2002-2005 DataDoctor.Biz

Home | Contact us | Downloads | Services | Terms and conditions | Site map

Website Data Recovery | recuperación de Datos | Récupération de données | Datenrettung | Recupero dati | データ復旧 | 데이터 복구 | 数据恢复 | Восстановление данных | De terugwinning van gegevens | Ανάκτηση δεδομένων
Sitemap Site map1 2 3 4 | Spanish1 2 3 | French1 2 3 | German1 2 3 | Italian1 2 3 | Portuguese1 2 3 | Japanese1 2 3 | Korean1 2 3 | Chinese1 2 3 | Russian1 2 3 | Dutch1 2 3 | Greek1 2 3
Data Recovery Book English | Spanish | French | German | Italian | Portuguese | Japanese | Korean | Chinese | Russian | Dutch | Greek