Книги и журналы » Компьютерная литература » Программирование (книги)
Intermediate C ProgrammingГод издания: 2015
Автор: Yung-Hsiang Lu/Юнг-Хсианг Лу
Жанр или тематика: C Programming
Издательство: CRC Press
ISBN: 978-1-4987-1164-7
Язык: Английский
Формат: PDF
Качество: Издательский макет или текст (eBook)
Интерактивное оглавление: Да
Количество страниц: 494
Описание: «Существует очень мало книг для студентов среднего уровня. Эти студенты уже кое-что знают о программировании. Они не удивляются, когда видят if или while. Они знают, как создавать функции и вызывать функции. Они могут писать короткие программы, возможно, в десятки строк кода, но они не готовы обрабатывать программы в тысячу строк. Они часто допускают ошибки, но в большинстве книг говорится о том, как писать правильные программы, без особой помощи в том, чтобы избежать распространенных ошибок. Студенты не знакомы со многими концепциями и инструментами, которые могут помочь им писать лучшие программы. Этим студентам нужна ступенька, чтобы превратить их из способных писать короткие программы в способных писать реальные программы.
В настоящее время этот пробел частично восполняется книгами, посвященными структурам данных и алгоритмам. В этих книгах представлены программы, реализующие структуры данных или алгоритмы. Однако это не идеальное решение. Эти книги сосредоточены на предметах, структурах данных и алгоритмах, но редко содержат информацию, которая помогает студентам писать правильный код. На самом деле, они обычно включают программы без особых объяснений. Они не объясняют концепции программирования — например, зачем функции нужен указатель в качестве аргумента или в чем разница между глубоким и неглубоким копированием. В результате учащимся приходится осваивать эти навыки программирования самостоятельно.
Чтобы удовлетворить эту потребность, я пишу эту книгу для студентов среднего уровня. Эта книга идеально подходит в качестве второй книги по программированию».
[spoiler="Примеры страниц"]

[/spoiler]
[spoiler="Contents"]
I Computer Storage: Memory and File1 Program Execution1.1 Compile
1.2 Redirect Output
2 Stack Memory2.1 Values and Addresses
2.2 Stack
2.3 The Call Stack
2.3.1 The Return Location
2.3.2 Function Arguments
2.3.3 Local Variables
2.3.4 Value Address
2.3.5 Arrays
2.3.6 Retrieving Addresses
2.4 Visibility
2.5 Exercises
2.5.1 Draw Call Stack I
2.5.2 Draw Call Stack II
2.5.3 Addresses
2.6 Answers
2.6.1 Draw Call Stack I
2.6.2 Draw Call Stack II
2.6.3 Addresses
2.7 Examine the Call Stack with DDD
3 Prevent, Detect, and Remove Bugs3.1 Developing Software ≠ Coding
3.1.1 Before coding
3.1.2 During coding
3.1.3 After coding
3.2 Common Mistakes
3.2.1 Uninitialized Variables
3.2.2 Wrong Array Indexes
3.2.3 Wrong Types
3.3 Post-Execution and Interactive Debugging
3.4 Separate Testing Code from Production Code
4 Pointers4.1 Scope
4.2 The Swap Function
4.3 Pointers
4.4 The Swap Function Revisited
4.5 Type Errors
4.6 Arrays and Pointers
4.7 Type Rules
4.8 Pointer Arithmetic
4.9 Exercises
4.9.1 Swap Function 1
4.9.2 Swap Function 2
4.9.3 Swap Function 3
4.9.4 Swap Function 4
4.9.5 Swap Function 5
4.9.6 15,552 Variations
4.10 Answers
4.10.1 Swap Function 1
4.10.2 Swap Function 2
4.10.3 Swap Function 3
4.10.4 Swap Function 4
4.10.5 Swap Function 5
5 Writing and Testing Programs5.1 Distinct Array Elements
5.1.1 main Function
5.1.2 areDistinct Function
5.1.3 Compiling and Linking
5.1.4 make
5.2 Test Using Makefile
5.2.1 Generating Test Cases
5.2.2 Redirecting Output
5.2.3 Use diff to Compare Output
5.2.4 Adding Tests to Makefile
5.3 Invalid Memory Access
5.4 Using valgrind to Check Memory Access Errors
5.5 Test Coverage
5.6 Limit Core Size
5.7 Programs with Infinite Loops
6 Strings6.1 Array of Characters
6.2 String Functions in C
6.2.1 Copy: strcpy
6.2.2 Compare: strcmp
6.2.3 Finding Substrings: strstr
6.2.4 Finding Characters: strchr
6.3 Understanding argv
6.4 Counting Substrings
7 Programming Problems and Debugging7.1 Implementing String Functions
7.1.1 The C Library
7.1.2 Header File
7.1.3 mystring.h
7.1.4 Creating Inputs and Correct Outputs
7.1.5 Makefile
7.1.6 mystring.c
7.1.7 Using const
7.2 Debugging
7.2.1 Find Infinite Loops
7.2.2 Find Invalid Memory Accesses
7.2.3 Detect Invalid Memory Accesses
8 Heap Memory8.1 Creating Array with malloc
8.2 The Stack and the Heap
8.3 Functions that Return a Heap Address
8.4 Two-Dimensional Arrays in C
8.5 Pointers and Arguments
9 Programming Problems Using Heap Memory9.1 Sorting an Array
9.1.1 Generating Test Input and Expected Output
9.1.2 Redirecting Input
9.1.3 Sorting Integers
9.1.4 Using valgrind to Detect Memory Leaks
9.2 Sort Using qsort
9.2.1 qsort
9.2.2 The Comparison Function
9.2.3 Execution Examples
9.2.4 Sorting Strings
10 Reading and Writing Files10.1 Passing a File Name via argv
10.2 Reading from Files
10.2.1 Reading Characters: fgetc
10.2.2 Reading Integers: fscanf(...%d...)
10.3 Writing to Files
10.4 Readin and Writing Strings
11 Programming Problems Using File11.1 Sorting a File of Integers
11.2 Counting the Occurrences of Characters
11.3 Counting the Occurrences of a Word
11.4 How to Comment Code
II Recursion12 Recursion12.1 Selecting Balls with Restrictions
12.1.1 Balls of Two Colors
12.1.2 Balls of Three Colors
12.1.3 A Further Restriction
12.2 One-Way Streets
12.3 The Tower of Hanoi
12.4 Calculating Integer Partitions
12.4.1 Count the Number of “1”s
12.4.2 Odd Numbers Only
12.4.3 Increasing Values
12.4.4 Alternating Odd and Even Numbers
12.4.5 Generalizing the Integer Partition Problem
12.4.6 How Not to Solve the Integer Partition Problem
13 Recursive C Functions13.1 Select Balls with Restrictions
13.2 One-Way Streets
13.3 The Tower of Hanoi
13.4 Integer Partition
13.5 Factorial
13.6 Fibonacci Numbers
13.7 Performance Profiling with gprof
14 Integer Partition14.1 Stack and Heap Memory
14.2 Trace Recursive Function Calls
14.3 Generating Partitions with Restrictions
14.3.1 Using Odd Numbers Only
14.3.2 Using Sequences of Increasing Numbers
14.3.3 Using Alternating Odd and Even Numbers
14.3.4 Using gprof and gcov to Identify Performance Bottlenecks
15 Programming Problems Using Recursion15.1 Binary Search
15.2 Quick Sort
15.3 Permutations and Combinations
15.4 Stack Sort
15.4.1 Example 1
15.4.2 Example 2
15.4.3 Example 3
15.4.4 Example 4
15.4.5 Stack Sortable
15.5 Tracing a Recursive Function
15.6 A Recursive Function with a Mistake
III Structure16 Programmer-Defined Data Types16.1 Struct and Object
16.2 Passing Objects as Arguments
16.3 Objects and Pointers
16.3.1 Returning an Object
16.3.2 Objects and malloc
16.4 Constructors and Destructors
16.5 Structures within Structures
16.6 Binary Files and Objects
17 Programming Problems Using Structure17.1 Sorting a Person Database
17.2 Packing Decimal Digits
17.2.1 Number Systems
17.2.2 Packing Two Decimal Digits in to One Byte
17.2.3 Bit Operations
17.2.4 Inserting and Retrieving Decimal Digits
17.2.5 DecPack Program
17.3 Binary File and Pointer
18 Linked Lists18.1 Expandable Types
18.2 Linked Lists
18.3 Inserting Data
18.4 Searching a Linked List
18.5 Deleting from a Linked List
18.6 Printing a Linked List
18.7 Destroying a Linked List
19 Programming Problems Using Linked List19.1 Queues
19.2 Sorting Numbers
19.3 Sparse Arrays
19.4 Reversing a Linked List
20 Binary Search Trees20.1 Binary Search Tree
20.2 Inserting Data into a Binary Search Tree
20.3 Searching a Binary Search Tree
20.4 Printing a Binary Tree
20.5 Deleting from a Binary Search Tree
20.6 Destroying a Binary Search Tree
20.7 main
20.8 Makefile
20.9 Counting the Different Shapes of a Binary Tree
21 Parallel Programming Using Threads21.1 Parallel Programming
21.2 Multi-Tasking
21.3 POSIX Threads
21.4 Subset Sum
21.4.1 Generate Test Cases
21.4.2 Sequential Solution
21.4.3 Multi-Threaded Solution
21.5 Interleaving the Execution of Threads
21.6 Thread Synchronization
21.7 Amdahl’s Law
IV Applications22 Finding the Exit of a Maze22.1 Maze File Format
22.2 Reading the Maze File
22.3 The Maze Structure
22.4 An Escape Strategy
22.5 Implementing the Strategy
22.5.1 canMove Function
22.5.2 getOut Function
22.5.3 Printing Visited Locations
23 Image Processing23.1 Structure for Image
23.2 Processing Images
23.2.1 Image Pixels and Colors
23.2.2 Processing Functions
23.2.3 Applying a Color Filter
23.2.4 Inverting the Image Colors
23.2.5 Edge Detection
23.2.6 Color Equalization
24 Huffman Compression24.1 Example
24.2 Encoding
24.2.1 Count Frequencies
24.2.2 Sort by Frequency
24.2.3 Build a Code Tree
24.2.4 Build a Code Book
24.2.5 Compress a File
24.2.6 Compress with Bits
24.3 Decoding
A LinuxA.1 Options for Installing Linux
A.2 Getting Ubuntu Linux
A.3 Downloading and Installing VirtualBox
A.4 Install and Update Linux
A.5 Install Programming Tools
B Version ControlB.1 Github.com
B.2 Cloning a Repository and Modifying a File
B.3 Adding Files and Directories
B.4 Revising a Program
C Integrated Development Environments (IDE)C.1 Eclipse
C.2 Create and Build a Project
C.3 Debugging the Program
Index [/spoiler]
codeYouTube