C has really only four types of variables:

1. char
2. int
3. float
4. double



Keyword Variable Type Range

char Character (or string) -128 to 127 (1 byte)

int Integer -32,768 to 32,767 (4 byte)

short Short integer -32,768 to 32,767 (4 byte)

short int Short integer -32,768 to 32,767 (4 byte)

long Long integer -2,147,483,648 to 2,147,483,647

unsigned char Unsigned character 0 to 255
unsigned int Unsigned integer 0 to 65,535
unsigned short Unsigned short integer 0 to 65,535
unsigned long Unsigned long integer 0 to 4,294,967,295

float Single-precision +/-3.4E10^38 to +/-3.4E10^38
floating-point
(accurate to 7 digits)

double Double-precision +/-1.7E10^308 to +/-1.7E10^308
floating-point
(accurate to 15 digits)

--

Pointer is the address in thememory.

Pointer is a data type just like int,float, and char.

int

* 4 bytes(假設硬體為32位元)
* 其內容存放2補數的整數數值
* 運算子(operator) : +,-,*(乘法),/,%,&(bitAND),|,^,~,<<,>>,=

int*

* 4 bytes(假設硬體為32位元)
* 其內容存放記憶體的地址(可視為unsigned int)
* 運算子(operator):*(透過pointer取記憶體內容),&(取變數地址),=,+,-


相關資源:

C Language Tutorial

C程式語言教學

--

How to get maximum and minimum values of data type ?


main(){
int i,j ;
i = 1;

while (i > 0) {
j = i;
i++;
}
printf ("the maximum value of integer is %d\n",j);
printf ("the value of integer after overflow is %d\n",i);
}
arrow
arrow
    全站熱搜

    tttt 發表在 痞客邦 留言(0) 人氣()