簡介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 Search

推薦內容橫式

本月熱門文章

北京故宮首訪,一窺清宮秘史 大玉兒 & 甄嬛

台灣人波蘭旅遊小撇步

蔣經國時代 1981年 陳文成命案 始終沒有一個交代!

Crypto.com 要發卡了,期待 ~! 申請的Ruby Steel這個級別 送Spotify

PTT企業綽號列表

還原林宅血案:監察委員田秋堇第一手證言

八炯統戰影片心得 千萬要謹慎 勿掉入金錢陷阱

1947年228事件 台灣人民應該持續去了解歷史,尋找真相

悲痛!XREX區塊鏈金融犯罪調查師陳梅慧Miffy殞落,揭露虛擬貨幣犯罪背後的黑幕

台灣人去波蘭 都會去哪些地方? 「雙城記」:首都華沙 (Warsaw) 與古都克拉科夫 (Krakow)

這個網誌中的熱門文章

Android應用開發豆知識:利用 adb 安裝 apk 到裝置上

Android 中文輸入法 官方版 ! Gboard - Google 鍵盤 開始支援注音輸入啦

Google Play 推薦Android app 誠徵App排行榜

北京故宮首訪,一窺清宮秘史 大玉兒 & 甄嬛

[家教][社會觀察] 建中教我的事 沒上建中被父母親折磨? 在建中到底是如何 ...

[FAANG面試] Amazon/AWS 領導力準則 14 Amazon Leadership Principles

[品質控制] 什麼是Sanity test ? 軟體測試常見名詞整理 包含不同部門的測試人員負責範圍

Acer ICONIA Smart S300 更新後越來越好 Acer也有出手機?!

新鮮人找工作:職場名詞解釋 AE FAE Pre-sales Post-sales