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

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

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

定 價:¥59.80

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

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

內(nèi)容簡介

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

作者簡介

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

圖書目錄

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

本目錄推薦

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