在好例子网,分享、交流、成长!
您当前所在位置:首页Others 开发实例一般编程问题 → Intermediate C Programming

Intermediate C Programming

一般编程问题

下载此实例
  • 开发语言:Others
  • 实例大小:12.03M
  • 下载次数:1
  • 浏览次数:118
  • 发布时间:2020-07-22
  • 实例类别:一般编程问题
  • 发 布 人:robot666
  • 文件格式:.pdf
  • 所需积分:2
 

实例介绍

【实例简介】
普渡大学陆永祥教授著作,适合有C语言基础的人学习,书是全英文的。
This page intentionally left blank Intermediate C Programming Yung-Hsiang Lu Purdue universi West lafayette IN, USA CRC) CRC Press Boca raton London New York CRC Press is an imprint of the Taylor Francis Group, an informa business a chapman hall booK CRC Press Taylor Francis Group 6000 Broken Sound Parkway NW, Suite 300 Boca raton Fl 33487-2742 o 2015 by Taylor Francis Group, LLC CRC Press is an imprint of Taylor Francis Group, an Informa business No claim to original U.S. Government works Version date: 20150407 International Standard Book Number-13: 978-1-4987-1164-7(eBook - PDF) This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the valid ity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or uti- lized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopy ing, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers Forpermissiontophotocopyorusematerialelectronicallyfromthisworkpleaseaccesswww.copyright.com(http:// www.copyright.com/)orcontacttheCopyrightClearancecEnter,Inc.(ccc),222RosewoodDrive,Danvers,Ma01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe Visit the Taylor francis Web site at http://www.taylorandfrancis.com and the crc press Web site at http://www.crcpress.com Contents List of Figures X11 List of tables Foreword Preface XX111 Author. Reviewers and artist XVI Rules in Software DevelopIment Source Code I Computer storage: memory and File 1 Program Execution 1. 1 Compile 3 1.2 Redirect Out put 2 Stack Memory 2.1 Values and Addresses ) 2.3 The call Stack 2.3.1 The return Location 2.3.2 Function Arguments 2.3.3 Local variables 2.3.4Ⅴ alue addres 2.3.5 Arrays 20 2.3.6 Retrieving Addresses 21 2. 4 Visibility 21 2.5 Exercis 24 2.5.1 Draw Call Stack I 24 2.5.2 Draw call stack Il 25 2.5.3 Addresses 25 2.6 Answers 2.6.1 Draw Call Stack 26 2.6.2 Draw Call Stack Il 2.6.3 Addresses 27 2. 7 Examine the Call Stack with DDD 27 Contents 3 Prevent, Detect, and remove bugs 33 3.1 Developing Software f Coding 33 3.1.1 Before coding 34 3.1.2 During coding 34 3.1.3Aft di r coding 35 3.2 Common mistakes 35 3.2.1 Uninitialized variables 36 3.2.2 Wrong array Indexes 36 3.2.3 Wrong 36 3.3 Post-Execution and Interactive Debuggin 36 3.4 Separate Testing Code from Production Code 4 Pointers 39 4.1S 39 4.2 The Swap function 41 4.3 Pointers 43 4.4 The Swap Function Revisited 47 4.5 Type errors 4.6 Arrays and Pointers 4.7 Typc Ru 54 4.8 Pointer Arithmetic 55 4.9 Exercises 59 1.9.1 Swap Function 1 59 4.9.2 Swap Function 2 59 4.9.3 Swap Function 3 4.9.4 Swap Function 4 60 4.9.5 Swap Function 5 61 4.9.6 15.552 Variations 61 4.10 Answers 62 4.10.1 Swap Function 1 62 4.10.2 Swap Function 2 63 4.10.3 Swap Function 3 63 4.10.4 Swap Function 4 63 4.10.5 Swap Function 5 63 5 Writing and Testing PrograIrls 65 5. 1 Distinct Array Flements 65 5.1.1 main Function 66 5.1.2 areDistinct Function 67 5.1.3 Compiling and linking 68 5.1. 4 make 69 5.2 Test Using makefile 71 5. 2.1 Generating Test Cases 72 5. 2.2 Redirecting Output 72 5.2.3 Csc diff to Comparc Output 73 5. 2.4 Adding Tests to Makefile 5.3 Invalid Memory Access 75 5.4 Using valgrind to Check Memory Access Errors 5.5 Test Coverage 79 5.6 Limit Core Size 82 5.7 Programs with Infinite Loops Contents 6 strings 5 6.1 Array of Characters 6.2 String Functions in C 6.2.1 Copy: strcpy 6.2.2 Comparc:strcmp 6.2.3 Finding Substrings: strstr 6.2.4 Finding Characters: strchr 6.3 Understanding argv 91 6.4 Counting substrings 93 7 Prograllning Problens anld Debugging 7.1 Implementing String Functions 97 7.1.1 The C Library 97 7. 1.2 Leader File 7.1.3 mystring h..... 99 7.1.4 Creating Inputs and Correct Outputs .100 7.1.5 Makefile 104 7.1.6 mystring.c· ..105 7.1.7 tsing const 7.2 Debugging 108 7.2.1 Find Infinite Loops 108 7.2.2 Find Invalid Memory Accesses 109 7. 2.3 Detect Invalid Memory Accesses 8 Heap Memory 113 8.1 Creating Array with malloc 8.2 The Stack and the hea 8.3 Functions that Return a Heap Address 8.4 Two-Dimensional Arrays in C 8.5 Pointers and Arguments 122 9 Programming Problems Using Heap Memory 125 9.1 Sorting an arra 125 9.1.1 Generating Test Imput and Expected Output 125 9.1.2 Redirecting Input 127 9.1.3 Sorting integers 9.1.4 Csing valgrind to Detect Memory Leaks 132 9. 2 Sort tsing qsort 133 9.2.1 qsort 133 9.2.2 The Comparison Function 135 9.2.3Ex ...137 9.2. 4 Sorting Strings 138 10 Reading and Writing Files 141 10.1 Passing a File Name via argv 141 10.2 Reading from Files 142 10.2.1 Reading Characters: fgetc 142 10.2.2 Reading Integers: fscanf(..%d.) 145 10.3 Writing to files 147 10.4 Reading and Writing Strings 150 11 Programming Problems Using File 153 11.1 Sorting a File of Integers 153 11.2 Counting the Occurrences of Characters 155 11.3 Counting the Occurrences of a Word 158 11. 4 How to comment codc 160 I Recursion 163 12 Recursion 165 12.1 Selecting Balls with Restrictions 166 12.1.1 Balls of two colors 166 12.1.2 Balls of Three colors 167 12.1.3 A Further restriction 168 12.2 One-Way Streets 170 12.3 The Tower of hanoi 171 12.4 Calculating Integer Partitions 174 12.4.1 Count the number of“1”s 175 12.4.2 Odd Numbcrs only 177 12.4.3 Increasing Values 178 12.4.4 Alternating Odd and Even Numbers 179 12.4.5 Generalizing the Integer Partition Problem 8 12.4.6 Ilow not to Solve the Integer partition Problem 181 13 Recursive C functions 183 13.1 Select balls with restrictions 184 13.2 One-Way Streets 187 13.3 The Tower of hanoi 188 13.4 Integer Partition 190 13.5 Factorial 191 13.6 Fibonacci numbers 193 13.7 Performance Profiling with gprof 199 14 Integer Partition 201 14.1 Stack and Hcap memory 202 14.2 Trace Recursive Function Calls 10 14.3 Genera.ting Partitions with Restrictions 213 11.3.1 Using odd Numbers only ,214 14.3.2 Csing Sequences of Increasing Numbers 14.3.3 Csing Alternating Odd and Even Numbers 14.3.4 sing gprof and gcov to Identify Performance Bottlenecks 15 Programming Problems Using Recursion 223 15.1 Binary Search 223 15.2 Quick Sort 226 15.3 Permutations and combinations 232 15.4 Stack sor 236 15.4.1 Example 1 236 15.4.2E 237 15.4.3 Examplc 3 37 15.4.4 Example 4 15.4.5 Stack Sortable 238 Contents 15.5 Tracing a Recursive Function 242 15.6 A Recursive Function with a mistake III Structure 247 16 Programmer-Defined Data Types 249 16.1 Struct and object 250 16.2 Passing Objects as Arguments 253 16.3 Objects and Pointers 256 16.3.1 Returning an Object 258 16.3.2 Objects and malloc .258 16.4 Constructors and Destructors 261 16.5 Structures within structures 268 16.6 Binary Files and Objects 17 Programming Problems Using Structurc 275 17.1 Sorting a Person Database 17.2 Packing Decimal Digits 281 17.2.1 Number Systems 281 17.2.2 Packing Two Decimal Digits into One Byte 17.2.3 Bit Operations 283 17.2.4 Inserting and Retrieving Decimal Digits 17.2.5 DecPack program 17.3 Binary File and Pointer 290 i 8 Linked lists 293 18.1 Expandable Types 293 18.2 Linked lists 294 18.3 Inserting data 295 18.4 Searching a Linked List ..297 18.5 Deleting from a Linked List .298 18.6 Printing a Linked List 30 18.7 Destroying a Linked list 19 Programming Problems Using Linked list 307 19.1 Queues 307 19.2 Sorting numbers 308 19.3 Sparse Arrays 308 19.4 Reversing a Linked list 20 Binary Search Trees 317 20. 1 Binary Search Tree 318 20.2 Inserting Data into a Binary Search Tree 319 20.3 Searching a Binary Search Tree 323 20.4 Printing a Binary Tree 325 20.5 Deleting from a Binary Search Tree 327 20.6 Destroying a Binary Scarch Trcc 330 20.7 main 20.8 Makefile 332 20.9 Counting the Different Shapes of a Binary Tree 332 【实例截图】
【核心代码】

标签:

实例下载地址

Intermediate C Programming

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警