簡介C的資料型態

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);
}

留言

Google

本月熱門文章

香港朋友,真的對唔住,台灣出了這種中共的幫兇!

堅持5個月!反送中示威者六大特色 6 features of Hong Kong Anti-ELAB Protesters│老外看香港│郝毅博 Ben Hedges│新唐人電視台

[黑金] 台南88槍擊案主犯國民黨學甲區黨部主委王文宗 也擔任統促黨幹部

熱門文章

企鵝妹/柳允進 史上最暈的TT三分鐘完整版一次看個夠

陳昇 Bobby Chen【把悲傷留給自己 I left sadness to myself】Official Music Video

裝潢師傅貼圖來了唷

香港朋友,真的對唔住,台灣出了這種中共的幫兇!

新手自建監控雲最快的方式:推薦QNAP NAS 搭配QVR Pro

2020 中華民國 台灣 失業補助申請方式 失業給付申請

香港朋友看服貿 - 嗨,我是香港人,一個CEPA的受害者。

堅持5個月!反送中示威者六大特色 6 features of Hong Kong Anti-ELAB Protesters│老外看香港│郝毅博 Ben Hedges│新唐人電視台