1 C 語言概述······························································································································1
1.1 C語言的發(fā)展過程········································································································1
1.2 當代最優(yōu)秀的程序設計語言·······················································································1
1.3 C語言版本···················································································································1
1.4 C語言的特點···············································································································1
1.5 面向對象的程序設計語言···························································································2
1.6 C和C++···················································································································2
1.7 簡單的C程序介紹·······································································································2
1.8 輸入和輸出函數(shù)··········································································································4
1.9 C源程序的結構特點····································································································5
1.10 書寫程序時應遵循的規(guī)則·························································································5
1.11 C語言的字符集··········································································································5
1.12 C語言詞匯·················································································································5
1.13 Turbo C 2.0集成開發(fā)環(huán)境的使用··············································································7
1.13.1 Turbo C 2.0簡介和啟動···················································································7
1.13.2 Turbo C 2.0集成開發(fā)環(huán)境···············································································7
1.13.3 File 菜單···········································································································8
1.13.4 Edit 菜單···········································································································9
1.13.5 Run 菜單·········································································································10
1.13.6 Compile 菜單··································································································11
1.13.7 Project 菜單····································································································12
1.13.8 Options 菜單···································································································13
1.13.9 Debug 菜單·····································································································17
1.13.10 Break/watch 菜單··························································································18
1.13.11 Turbo C 2.0的配置文件···············································································19
2 程序的靈魂—算法················································································································20
2.1 算法的概念················································································································20
2.2 簡單算法舉例············································································································20
2.3 算法的特性················································································································23
2.4 怎樣表示一個算法·····································································································23
2.4.1 用自然語言表示算法······················································································23
2.4.2 用流程圖表示算法··························································································23
2.4.3 三種基本結構和改進的流程圖······································································27
2.4.4 用 N-S流程圖表示算法··················································································28
2.4.5 用偽代碼表示算法··························································································29
2.4.6 用計算機語言表示算法··················································································30
2.5 結構化程序設計方法·································································································30
3 數(shù)據(jù)類型、運算符與表達式·································································································31
3.1 C語言的數(shù)據(jù)類型······································································································31
3.2 常量與變量················································································································32
3.2.1 常量和符號常量······························································································32
3.2.2 變量·················································································································33
3.3 整型數(shù)據(jù)····················································································································33
3.3.1 整型常量的表示方法······················································································33
3.3.2 整型變量·········································································································34
3.4 實型數(shù)據(jù)····················································································································37
3.4.1 實型常量的表示方法······················································································37
3.4.2 實型變量·········································································································38
3.4.3 實型常數(shù)的類型······························································································39
3.5 字符型數(shù)據(jù)················································································································39
3.5.1 字符常量·········································································································39
3.5.2 轉義字符·········································································································40
3.5.3 字符變量·········································································································41
3.5.4 字符數(shù)據(jù)在內(nèi)存中的存儲形式及使用方法···················································41
3.5.5 字符串常量······································································································42
3.6 變量賦初值················································································································42
3.7 各類數(shù)值型數(shù)據(jù)之間的混合運算·············································································43
3.8 算術運算符和算術表達式·························································································44
3.8.1 C 運算符簡介···································································································45
3.8.2 算術運算符和算術表達式··············································································45
3.9 賦值運算符和賦值表達式·························································································47
3.10 逗號運算符和逗號表達式·······················································································49
3.11 小結··························································································································49
3.11.1 C的數(shù)據(jù)類型·································································································49
3.11.2 基本類型的分類及特點················································································49
3.11.3 常量后綴········································································································50
3.11.4 常量類型········································································································50
3.11.5 數(shù)據(jù)類型轉換································································································50
3.11.6 運算符優(yōu)先級和結合性················································································50
3.11.7 表達式············································································································50
4 最簡單的 C程序設計—順序程序設計················································································51
4.1 C語句概述·················································································································51
4.2 賦值語句····················································································································52
4.3 數(shù)據(jù)輸入輸出的概念及在 C 語言中的實現(xiàn)·····························································53
4.4 字符數(shù)據(jù)的輸入輸出·································································································54
4.4.1 putchar 函數(shù)(字符輸出函數(shù))·····································································54
4.4.2 getchar函數(shù)(鍵盤輸入函數(shù))·······································································54
4.5 格式輸入與輸出········································································································55
4.5.1 printf 函數(shù)(格式輸出函數(shù))·········································································55
4.5.2 scanf 函數(shù)(格式輸入函數(shù)) ···············································································58
4.6 順序結構程序設計舉例·····························································································62
5 分支結構程序························································································································64
5.1 關系運算符和表達式·································································································64
5.1.1 關系運算符及其優(yōu)先次序··············································································64
5.1.2 關系表達式······································································································64
5.2 邏輯運算符和表達式·································································································65
5.2.1 邏輯運算符極其優(yōu)先次序··············································································65
5.2.2 邏輯運算的值··································································································65
...
C語言是在 70 年代初問世的。一九七八年由美國電話電報公司(AT&T)貝爾實驗室正式發(fā)表了C語言。同時由 B.W.Kernighan 和 D.M.Ritchit 合著了著名的“THE C PROGRAMMING LANGUAGE”一書。通常簡稱為《K&R》 ,也有人稱之為《K&R》標準。
但是, 在 《K&R》 中并沒有定義一個完整的標準 C 語言, 后來由美國國家標準協(xié)會 (American National Standards Institute)在此基礎上制定了一個 C 語言標準,于一九八三年發(fā)表。通常稱之為 ANSI C。
1.2 當代最優(yōu)秀的程序設計語言
早期的 C 語言主要是用于 UNIX 系統(tǒng)。由于C語言的強大功能和各方面的優(yōu)點逐漸為人們認識,到了八十年代,C 開始進入其它操作系統(tǒng),并很快在各類大、中、小和微型計算機上得到了廣泛的使用,成為當代最優(yōu)秀的程序設計語言之一。