注冊(cè) | 登錄讀書(shū)好,好讀書(shū),讀好書(shū)!
讀書(shū)網(wǎng)-DuShu.com
當(dāng)前位置: 首頁(yè)出版圖書(shū)科學(xué)技術(shù)計(jì)算機(jī)/網(wǎng)絡(luò)網(wǎng)絡(luò)與數(shù)據(jù)通信網(wǎng)絡(luò)服務(wù)C語(yǔ)言學(xué)習(xí)筆記:從入門到實(shí)戰(zhàn)

C語(yǔ)言學(xué)習(xí)筆記:從入門到實(shí)戰(zhàn)

C語(yǔ)言學(xué)習(xí)筆記:從入門到實(shí)戰(zhàn)

定 價(jià):¥59.80

作 者: 薛小龍
出版社: 中國(guó)鐵道出版社有限公司
叢編項(xiàng):
標(biāo) 簽: 暫缺

購(gòu)買這本書(shū)可以去


ISBN: 9787113261757 出版時(shí)間: 2019-10-01 包裝:
開(kāi)本: 16開(kāi) 頁(yè)數(shù): 420 字?jǐn)?shù):  

內(nèi)容簡(jiǎn)介

  本書(shū)以學(xué)習(xí)筆記的形式循序漸進(jìn)地講解了使用C語(yǔ)言的核心知識(shí),并通過(guò)具體實(shí)例的實(shí)現(xiàn)過(guò) 程講解了各個(gè)知識(shí)點(diǎn)的使用方法和流程。全書(shū)簡(jiǎn)潔而不失其技術(shù)深度,內(nèi)容豐富全面,針對(duì)每 一個(gè)知識(shí)點(diǎn)均搭配典型案例講解和視頻;除此之外,本書(shū)易于閱讀,以極簡(jiǎn)的文字介紹了復(fù)雜 的案例,幫助讀者扎實(shí)理解實(shí)踐應(yīng)用。

作者簡(jiǎn)介

  薛小龍,山東大學(xué)計(jì)算機(jī)碩士。現(xiàn)就職于浪潮云,從事互聯(lián)網(wǎng)云服務(wù)器的架構(gòu)和研發(fā)工作。精通Java、Python、C、C++語(yǔ)言,擅長(zhǎng)大數(shù)據(jù)挖掘和數(shù)據(jù)分析工作。個(gè)人喜愛(ài)技術(shù)分享,曾經(jīng)寫作出版《開(kāi)發(fā)從入門到精通》系列圖書(shū),且擁有對(duì)圖書(shū)推廣和營(yíng)銷方面的經(jīng)驗(yàn)。

圖書(shū)目錄

第1 章 C 語(yǔ)言基礎(chǔ)知識(shí)介紹
1.1 永不過(guò)時(shí)的C 語(yǔ)言 ............................................................................................1
1.1.1 品味C 語(yǔ)言這一壇老酒 ....................................................................................1
1.1.2 C 語(yǔ)言的發(fā)展史 .................................................................................................2
1.1.3 學(xué)習(xí)C 語(yǔ)言還有用嗎 ........................................................................................2
1.2 認(rèn)識(shí)段C 語(yǔ)言程序 ....................................................................................3
1.2.1 編寫段C 語(yǔ)言程序 ....................................................................................3
實(shí)例1-1:段C 語(yǔ)言程序(定義變量并進(jìn)行算數(shù)操作) ................................................. 3
1.2.2 分析C 語(yǔ)言程序的具體組成 ............................................................................4
1.3 如何學(xué)好C 語(yǔ)言 ................................................................................................6
第2 章 安裝C 語(yǔ)言開(kāi)發(fā)工具
2.1 一步到位的Visual Studio ..................................................................................7
2.1.1 安裝Visual Studio 2017 .....................................................................................7
2.1.2 使用Visual Studio 2017 .....................................................................................9
實(shí)例2-1:使用Visual Studio 2017 運(yùn)行一個(gè)C 程序 ................................................................ 9
2.2 使用DEV C 開(kāi)發(fā)C 語(yǔ)言程序 ...................................................................12
2.2.1 安裝DEV C ..................................................................................................12
2.2.2 使用DEV C 運(yùn)行一個(gè)C 語(yǔ)言程序 ............................................................14
2.3 使用Turbo C 3.0 開(kāi)發(fā)C 語(yǔ)言程序 ................................................................14
2.3.1 安裝Turbo C 3.0 ...............................................................................................14
2.3.2 使用Turbo C 3.0 ...............................................................................................15
第3 章 C 語(yǔ)言語(yǔ)法基礎(chǔ)
3.1 標(biāo)識(shí)符和關(guān)鍵字 ..............................................................................................16
3.1.1 標(biāo)識(shí)符 ...............................................................................................................16
3.1.2 關(guān)鍵字 ...............................................................................................................17
3.2 數(shù)據(jù)類型 ..........................................................................................................19
3.3 常量和變量 ......................................................................................................20
3.3.1 常量 ...................................................................................................................20
3.3.2 變量 ...................................................................................................................21
實(shí)例3-1:計(jì)算圓的周長(zhǎng)和面積 ............................................................................................... 23
3.4 整型數(shù)據(jù) ..........................................................................................................24
3.4.1 整型常量 ...........................................................................................................24
3.4.2 整型變量 ...........................................................................................................26
實(shí)例3-2:計(jì)算兩個(gè)整型變量的和 ........................................................................................... 27
3.5 實(shí)型數(shù)據(jù)類型 ..................................................................................................28
3.5.1 實(shí)型常量 ...........................................................................................................28
3.5.2 實(shí)型變量 ...........................................................................................................29
實(shí)例3-3:對(duì)一個(gè)很大的數(shù)和一個(gè)很小的數(shù)進(jìn)行加法運(yùn)算 ................................................... 29
3.6 字符型數(shù)據(jù) ......................................................................................................30
3.6.1 字符常量詳解 ...................................................................................................30
實(shí)例3-4:通過(guò)轉(zhuǎn)義字符輸出指定的文本字符 ....................................................................... 31
3.6.2 字符串常量 .......................................................................................................32
實(shí)例3-5:我喜歡的偶像是歐陽(yáng)娜娜 ................................................................................... 32
3.6.3 字符變量 ...........................................................................................................33
實(shí)例3-6:將字符變量和整型變量進(jìn)行相互賦值 ................................................................... 33
3.7 整型、實(shí)型和字符型數(shù)據(jù)之間的運(yùn)算 ..........................................................34
3.7.1 強(qiáng)制轉(zhuǎn)換 ...........................................................................................................34
實(shí)例3-7:將int 類型強(qiáng)制轉(zhuǎn)換為double 類型 ........................................................................ 35
3.7.2 自動(dòng)轉(zhuǎn)換 ...........................................................................................................35
實(shí)例3-8:計(jì)算圓的大概面積和精確面積 ............................................................................... 36
第4 章 運(yùn)算符和表達(dá)式
4.1 運(yùn)算符和表達(dá)式介紹 ......................................................................................37
4.2 算術(shù)運(yùn)算符和算術(shù)表達(dá)式 ..............................................................................38
4.2.1 算術(shù)運(yùn)算符的分類 ...........................................................................................38
4.2.2 單目運(yùn)算符 .......................................................................................................39
實(shí)例4-1:使用單目運(yùn)算符實(shí)現(xiàn)基本的數(shù)學(xué)運(yùn)算 ................................................................... 39
4.2.3 雙目運(yùn)算符 .......................................................................................................39
實(shí)例4-2:獲取任意小于1000 的正整數(shù)的個(gè)位、十位、百位和千位的數(shù)字 ..................... 40
4.3 賦值運(yùn)算符和賦值表達(dá)式 ..............................................................................40
4.3.1 基本的賦值運(yùn)算符 ...........................................................................................41
4.3.2 復(fù)合賦值運(yùn)算符 ...............................................................................................43
4.3.3 賦值表達(dá)式 .......................................................................................................43
實(shí)例4-3:實(shí)現(xiàn)基本的賦值表達(dá)式運(yùn)算處理 ........................................................................... 43
4.4 關(guān)系運(yùn)算符和關(guān)系表達(dá)式 ..............................................................................44
4.4.1 關(guān)系運(yùn)算符 .......................................................................................................44
4.4.2 關(guān)系表達(dá)式 .......................................................................................................44
實(shí)例4-4:比較體重 ................................................................................................................... 45
4.5 逗號(hào)運(yùn)算符和逗號(hào)表達(dá)式 ..............................................................................46
4.5.1 逗號(hào)運(yùn)算符 .......................................................................................................46
4.5.2 逗號(hào)表達(dá)式 .......................................................................................................46
實(shí)例4-5:使用逗號(hào)運(yùn)算符實(shí)現(xiàn)數(shù)學(xué)運(yùn)算 ............................................................................... 47
4.6 邏輯運(yùn)算符和邏輯表達(dá)式 ..............................................................................48
4.6.1 邏輯運(yùn)算符 .......................................................................................................48
4.6.2 邏輯表達(dá)式 .......................................................................................................49
實(shí)例4-6:對(duì)變量進(jìn)行邏輯運(yùn)算處理,并輸出運(yùn)算后的結(jié)果 ............................................... 49
4.7 求字節(jié)數(shù)運(yùn)算符sizeof ....................................................................................50
實(shí)例4-7:使用sizeof 運(yùn)算符計(jì)算不同類型數(shù)據(jù)的字節(jié)大小 ................................................ 51
4.8 運(yùn)算符的優(yōu)先級(jí) ..............................................................................................52
第5 章 數(shù)據(jù)的輸入和輸出
5.1 語(yǔ)句介紹 ..........................................................................................................54
5.1.1 C 語(yǔ)句簡(jiǎn)介 .......................................................................................................54
5.1.2 賦值語(yǔ)句 ...........................................................................................................56
5.2 C 語(yǔ)言內(nèi)置的數(shù)據(jù)輸入和輸出函數(shù) ...............................................................57
5.2.1 使用字符輸出函數(shù)putchar ..............................................................................58
實(shí)例5-1:使用函數(shù)putchar 輸出指定的字符 ......................................................................... 58
5.2.2 使用字符輸入函數(shù)getchar .............................................................................59
實(shí)例5-2:使用getchar 函數(shù)獲取在鍵盤中輸入的內(nèi)容.......................................................... 60
5.2.3 使用格式輸出函數(shù)printf .................................................................................60
實(shí)例5-3:使用printf 函數(shù)輸出不同格式變量a 和b 的數(shù)據(jù) ................................................ 61
實(shí)例5-4:使用printf 格式字符輸出指定格式的數(shù)據(jù) ............................................................ 62
5.2.4 使用格式輸入函數(shù)scanf ..................................................................................64
實(shí)例5-5:輸出顯示用戶輸入字符的ASCII 碼和對(duì)應(yīng)的大寫字母 ....................................... 66
5.2.5 使用字符串輸出函數(shù)puts ...............................................................................67
實(shí)例5-6:使用函數(shù)puts 輸出指定的字符串 ........................................................................... 67
5.2.6 使用字符串輸入函數(shù)gets ................................................................................68
實(shí)例5-7:輸出顯示用戶的姓名和身高信息 ........................................................................... 68
第6 章 使用流程控制語(yǔ)句
6.1 順序結(jié)構(gòu) ..........................................................................................................69
實(shí)例6-1:計(jì)算三角形的面積 ................................................................................................... 70
6.2 選擇結(jié)構(gòu) ..........................................................................................................70
6.2.1 單分支結(jié)構(gòu)語(yǔ)句 ...............................................................................................71
實(shí)例6-2:從大到小排列3 個(gè)數(shù)字 ........................................................................................... 71
6.2.2 雙分支結(jié)構(gòu)語(yǔ)句 ...............................................................................................72
實(shí)例6-3:判斷用戶輸入內(nèi)容的格式 ....................................................................................... 72
實(shí)例6-4:判斷變量a 和b 的值是多少 ................................................................................... 74
6.2.3 使用多分支結(jié)構(gòu)語(yǔ)句 .......................................................................................75
實(shí)例6-5:提示用戶輸入數(shù)字,然后將用戶輸入的數(shù)字輸出。 ........................................... 77
6.2.4 條件運(yùn)算符和條件表達(dá)式 ...............................................................................77
實(shí)例6-6:比較兩個(gè)數(shù)字的大小并輸出數(shù) ....................................................................... 79
6.3 循環(huán)結(jié)構(gòu) ..........................................................................................................79
6.3.1 使用for 語(yǔ)句 ....................................................................................................79
實(shí)例6-7:計(jì)算某個(gè)整數(shù)的階乘 ............................................................................................... 80
6.3.2 使用while 循環(huán)語(yǔ)句 ........................................................................................81
實(shí)例6-8:依次輸出1*1、1*2…到1*20 的積 ........................................................................ 82
6.3.3 使用do-while 語(yǔ)句 ...........................................................................................83
實(shí)例6-9:猜數(shù)游戲 ................................................................................................................... 84
6.3.4 正確對(duì)待goto 語(yǔ)句 ..........................................................................................84
實(shí)例6-10:統(tǒng)計(jì)從鍵盤輸入一行字符的個(gè)數(shù) ......................................................................... 85
6.3.5 使用break 語(yǔ)句 ................................................................................................85
實(shí)例6-11:計(jì)算圓的面積 ......................................................................................................... 86
6.3.6 使用continue 語(yǔ)句 ...........................................................................................86
實(shí)例6-12:輸出顯示100 到200 之間的不能被3 整除的整數(shù) ............................................. 87
6.3.7 死循環(huán)/ 退出程序 ............................................................................................87
第7 章 數(shù)組存儲(chǔ)數(shù)據(jù)
7.1 使用一維數(shù)組 ..................................................................................................89
7.1.1 定義一維數(shù)組 ...................................................................................................89
7.1.2 引用即使用 .......................................................................................................90
實(shí)例7-1:輸出數(shù)組內(nèi)的各個(gè)元素值 ....................................................................................... 91
7.1.3 數(shù)組需要初始化 ...............................................................................................91
實(shí)例7-2:實(shí)現(xiàn)一個(gè)由小到大排列的冒泡程序 ....................................................................... 92
7.2 多維數(shù)組 ..........................................................................................................93
7.2.1 二維數(shù)組 ...........................................................................................................93
實(shí)例7-3:輸出顯示10 行楊輝三角 ......................................................................................... 95
7.2.2 使用多維數(shù)組 ...................................................................................................96
實(shí)例7-4:獲取成績(jī)分的球員編號(hào) ................................................................................... 98
7.3 使用字符數(shù)組與字符串 ..................................................................................99
7.3.1 侃侃字符數(shù)組 ...................................................................................................99
7.3.2 字符串與字符數(shù)組 .........................................................................................100
7.3.3 字符數(shù)組的輸入輸出 .....................................................................................101
實(shí)例7-5:比較兩個(gè)字符串的大小 ......................................................................................... 102
7.4 使用字符處理函數(shù)和字符串處理函數(shù) ........................................................103
7.4.1 使用測(cè)試字符串長(zhǎng)度函數(shù)strlen ...................................................................103
實(shí)例7-6:使用函數(shù)strlen 輸出程序中數(shù)組字符串的長(zhǎng)度 .................................................. 103
7.4.2 使用字符串大小寫轉(zhuǎn)換函數(shù)strupr 和strlwr ...............................................103
實(shí)例7-7:分別輸出輸入字符串的小寫形式和大寫形式 ..................................................... 103
7.4.3 使用字符串復(fù)制函數(shù)strcpy 和strncpy ........................................................104
實(shí)例7-8:復(fù)制用戶輸入的字符串 ......................................................................................... 104
7.4.4 使用字符串比較函數(shù)strcmp 和strncmp ......................................................105
實(shí)例7-9:比較用戶輸入的字符串 ......................................................................................... 106
7.4.5 使用字符串連接函數(shù)strcat 和strncat ...........................................................106
實(shí)例7-10:連接用戶輸入的字符串 ....................................................................................... 107
7.4.6 將字符串轉(zhuǎn)換成數(shù)值的函數(shù) .........................................................................108
實(shí)例7-11:將用戶輸入的字符串轉(zhuǎn)換為數(shù)值類型的值 ....................................................... 108
7.4.7 使用字符檢測(cè)函數(shù) .........................................................................................109
實(shí)例7-12:判斷字符串中各字符所占用的個(gè)數(shù) ................................................................... 109
7.4.8 使用字符大小寫轉(zhuǎn)換函數(shù)tolower 和toupper ..............................................110
實(shí)例7-13:將字符串分別輸出轉(zhuǎn)換為大寫形式和小寫形式 ................................................111
第8 章 函數(shù)
8.1 函數(shù)基礎(chǔ)知識(shí)介紹 ........................................................................................ 112
8.1.1 函數(shù)的分類 .....................................................................................................112
8.1.2 函數(shù)的定義 .....................................................................................................114
實(shí)例8-1:比較兩個(gè)數(shù)字的大小 ..............................................................................................114
8.2 函數(shù)聲明和函數(shù)原型 .................................................................................... 115
8.2.1 函數(shù)聲明 .........................................................................................................115
實(shí)例8-2:求s=(1 2 3 … n)/(1 2 3 … m) 的值 ...............................................................116
8.2.2 函數(shù)原型 .........................................................................................................117
8.3 函數(shù)的參數(shù) .................................................................................................... 117
8.3.1 形參和實(shí)參詳解 .............................................................................................117
實(shí)例8-3:計(jì)算從1 到某個(gè)數(shù)字值的和 ..................................................................................118
8.3.2 將數(shù)組作為函數(shù)參數(shù) .....................................................................................118
實(shí)例8-4:判斷一個(gè)整數(shù)是否大于0 .......................................................................................119
實(shí)例8-5:互換二維數(shù)組中行和列的元素 ............................................................................. 120
8.4 函數(shù)的返回值 ................................................................................................120
實(shí)例8-6:計(jì)算兩個(gè)整數(shù)3 和4 的和 ..................................................................................... 121
8.5 實(shí)現(xiàn)函數(shù)的調(diào)用 ............................................................................................122
8.5.1 調(diào)用函數(shù)的格式 .............................................................................................122
實(shí)例8-7:比較3 個(gè)數(shù)字的大小 ............................................................................................. 122
8.5.2 函數(shù)調(diào)用的方式 .............................................................................................123
實(shí)例8-8:計(jì)算公約數(shù)和小公倍數(shù) ............................................................................. 123
8.6 函數(shù)的嵌套調(diào)用和遞歸調(diào)用 ........................................................................124
8.6.1 函數(shù)嵌套調(diào)用詳解 .........................................................................................124
實(shí)例8-9:輸出字符串中長(zhǎng)的單詞 ..................................................................................... 125
8.6.2 函數(shù)遞歸調(diào)用 .................................................................................................126
實(shí)例8-10:實(shí)現(xiàn)數(shù)學(xué)中Hanoi 塔問(wèn)題的解決方案................................................................ 127
8.7 變量的作用域 ................................................................................................129
8.7.1 局部變量作用域 .............................................................................................129
實(shí)例8-11:計(jì)算長(zhǎng)方體的體積和三個(gè)面的面積 ................................................................... 129
8.7.2 全局變量作用域 .............................................................................................130
實(shí)例8-12:超市價(jià)格調(diào)整 ....................................................................................................... 130
8.8 靜態(tài)存儲(chǔ)變量和動(dòng)態(tài)存儲(chǔ)變量 ....................................................................131
8.8.1 靜態(tài)存儲(chǔ)和動(dòng)態(tài)存儲(chǔ)的區(qū)別 .........................................................................132
8.8.2 四種變量存儲(chǔ)類型 .........................................................................................132
8.8.3 自動(dòng)變量 .........................................................................................................132
8.8.4 外部變量 .........................................................................................................133
實(shí)例8-13:在函數(shù)間通過(guò)外部函數(shù)直接傳遞數(shù)據(jù) ............................................................... 134
8.8.5 靜態(tài)變量 .........................................................................................................134
實(shí)例8-14:使用靜態(tài)變量設(shè)置初始值 ................................................................................... 136
8.8.6 寄存器變量 .....................................................................................................136
實(shí)例8-15:使用register 變量提升效率 ................................................................................. 136
8.9 內(nèi)部函數(shù)和外部函數(shù) ....................................................................................137
8.9.1 內(nèi)部函數(shù)詳解 .................................................................................................137
實(shí)例8-16:在不同的文件內(nèi)使用同一個(gè)名稱的函數(shù) ........................................................... 138
8.9.2 使用外部函數(shù) .................................................................................................138
實(shí)例8-17:在一個(gè)文件內(nèi)調(diào)用另一個(gè)外部函數(shù) ................................................................... 138
8.10 庫(kù)函數(shù) ..........................................................................................................139
8.10.1 庫(kù)函數(shù)介紹 ...................................................................................................139
8.10.2 庫(kù)函數(shù)的分類 ...............................................................................................139
第9 章 使用指針
9.1 指針和內(nèi)存地址 ............................................................................................141
9.2 變量的指針和指向變量的指針變量 ............................................................142
9.2.1 聲明指針變量 .................................................................................................142
9.2.2 初始化指針變量 .............................................................................................143
9.2.3 引用指針變量 .................................................................................................144
實(shí)例9-1:將兩個(gè)指針變量分別指向兩個(gè)變量 ..................................................................... 145
9.2.4 指針運(yùn)算符 .....................................................................................................145
實(shí)例9-2:對(duì)輸入的數(shù)字進(jìn)行排序處理 ................................................................................. 146
9.2.5 指針變量的運(yùn)算 .............................................................................................147
實(shí)例9-3:順序顯示數(shù)組內(nèi)的元素并分別逆向輸出 ............................................................. 148
9.2.6 指針變量作為函數(shù)參數(shù) .................................................................................148
實(shí)例9-4:按照從小到大的順序排序輸出三個(gè)整數(shù) ............................................................. 150
9.2.7 void 類型的指針 .............................................................................................151
實(shí)例9-5:定義4 個(gè)類型的變量,然后分別輸出轉(zhuǎn)換后的結(jié)果 ......................................... 151
9.3 指針和數(shù)組 ....................................................................................................152
9.3.1 數(shù)組元素的指針 .............................................................................................153
9.3.2 指向一維數(shù)組元素的指針變量 .....................................................................154
9.3.3 通過(guò)指針引用數(shù)組元素 .................................................................................155
實(shí)例9-6:分別通過(guò)指向數(shù)組的指針引用數(shù)組、利用數(shù)組名和下標(biāo)引用數(shù)組 ................. 156
9.3.4 數(shù)組名作函數(shù)參數(shù) .........................................................................................158
實(shí)例9-7:將數(shù)組中的元素按相反順序存放 ......................................................................... 158
實(shí)例9-8:輸出數(shù)組元素中的值和小值 ..................................................................... 159
9.4 指針和多維數(shù)組 ............................................................................................160
9.4.1 多維數(shù)組的地址 .............................................................................................160
實(shí)例9-9:輸出顯示二維數(shù)組元素的地址 ............................................................................. 162
9.4.2 指向多維數(shù)組的指針變量 .............................................................................162
實(shí)例9-10:2*3 或3*4 矩陣相乘運(yùn)算 .................................................................................... 164
9.5 指針和字符串 ................................................................................................165
9.5.1 指針訪問(wèn)字符串 .............................................................................................165
實(shí)例9-11:把一個(gè)字符串的內(nèi)容復(fù)制到另一個(gè)字符串中 ................................................... 166
9.5.2 字符串指針作函數(shù)參數(shù) .................................................................................167
實(shí)例9-12:使用函數(shù)調(diào)用復(fù)制字符串的內(nèi)容 ....................................................................... 167
9.6 指針數(shù)組和多級(jí)指針 ....................................................................................168
9.6.1 指針數(shù)組 .........................................................................................................168
9.6.2 多級(jí)指針的定義和應(yīng)用 .................................................................................169
實(shí)例9-13:對(duì)5 個(gè)字符串進(jìn)行排序 ....................................................................................... 170
9.6.3 指向指針的指針 .............................................................................................171
9.6.4 main 函數(shù)的參數(shù) ............................................................................................171
實(shí)例9-14:使用帶參數(shù)的main 函數(shù)輸出指針數(shù)組參數(shù)的值 ............................................. 172
9.7 指針函數(shù)和函數(shù)指針 ....................................................................................173
9.7.1 指針函數(shù) .........................................................................................................173
9.7.2 函數(shù)指針 .........................................................................................................173

本目錄推薦

掃描二維碼
Copyright ? 讀書(shū)網(wǎng) ranfinancial.com 2005-2020, All Rights Reserved.
鄂ICP備15019699號(hào) 鄂公網(wǎng)安備 42010302001612號(hào)