自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(133)
  • 资源 (1)
  • 收藏
  • 关注

翻译 Pointers on C——12 Using Structures and Pointers.4

Optimizing the Insert Function二、优化插入函数It appears that inserting a node at the beginning of the list must be a special case. After all, the pointer that must be adjusted to insert the first n

2017-09-18 08:59:04 503

翻译 Pointers on C——12 Using Structures and Pointers.3

Debugging the Insert Function调试插入函数Unfortunately, the insert function is incorrect. Try inserting the value 20 into the list and you will see one problem: the while loop runs off the e

2017-09-18 08:58:20 411

翻译 Pointers on C——12 Using Structures and Pointers.2

12.2.1 Inserting into a Singly Linked ListHow would we insert a new node into an ordered singly linked list? Suppose we had a new value, say 12, to insert into the previous list. Conceptually th

2017-09-10 10:44:26 269

翻译 Pointers on C——12 Using Structures and Pointers.1

You can create powerful data structures by combining structures and pointers. In this chapter we take a closer look at some techniques for using structures and pointers.We spend a lot of time with a

2017-09-10 10:42:53 245

翻译 Pointers on C——11 Dynamic Memory Allocation.6

11.7 SummaryWhen an array is declared, its size must be known at compile time. Dynamic allocation allows a program to create space for an array whose size isnʹt known until runtime.当数组

2017-09-10 10:42:14 215

翻译 Pointers on C——11 Dynamic Memory Allocation.5

11.6 Memory Allocation ExamplesA common use for dynamic memory allocation is obtaining space for arrays whose sizes are not known until run time. Program 11.2 reads a list of integers, sor

2017-09-10 10:40:28 340

翻译 Pointers on C——11 Dynamic Memory Allocation.4

11.5.1 Memory LeaksDynamically allocated memory should be freed when it is no longer needed so that it can be reused later for other purposes. Allocating memory but not freeing it later ca

2017-09-10 10:39:42 161

翻译 Pointers on C——11 Dynamic Memory Allocation.3

11.5 Common Dynamic Memory ErrorsThere are many errors that can occur in programs that use dynamic memory allocation. These include dereferencing NULL pointers, going outside die bounds of t

2017-09-10 10:38:53 282

翻译 Pointers on C——11 Dynamic Memory Allocation.2

11.3 Calloc and ReallocThere are two additional memory allocation functions, calloc and realloc. Their prototypes are shown below.另外还有两个内存分配函数, calloc 和realloc。 它们的原型如下所示:voi

2017-09-10 10:38:05 199

翻译 Pointers on C——11 Dynamic Memory Allocation.1

The elements of an array are stored in contiguous locations in memory. When an array is declared, its memory is allocated at compile time. However, you can also allocate the memory at runtime with d

2017-09-10 10:36:43 653

翻译 Pointers on C——10 Structures and Unions.16

​10.6.2 Initializing UnionsA union variable can be initialized, but the value must appropriate for the type of the first member of the union, and it must be enclosed in braces. For example,联

2017-09-10 10:35:40 186

翻译 Pointers on C——10 Structures and Unions.15

10.6.1 Variant Records变体记录Letʹs examine an example that implements what Pascal and Modula call a variant record. Conceptually, this is the same situation we just discussed—a particular area

2017-09-10 10:35:04 194

翻译 Pointers on C——10 Structures and Unions.14

10.6 UnionsA union is a different animal altogether. A union is declared like a structure but doesnʹt work like a structure. All of the members of a union refer to the same location(s)in mem

2017-09-09 09:45:29 153

翻译 Pointers on C——10 Structures and Unions.13

​10.5 Bit FieldsOne last thing to mention about structures is their capability for implementing bit fields. A bit field is declared exactly like a structure except that its members are fields of

2017-09-09 09:44:58 213

翻译 Pointers on C——10 Structures and Unions.12

10.4 Structures as Function ArgumentsA structure variable is a scalar and can be used wherever any other scalar can be used.Thus it is legal to pass a structure as an argument to a functio

2017-09-09 09:44:24 181

翻译 Pointers on C——10 Structures and Unions.11

10.3 Structure Storage AllocationHow are structures actually stored in memory? The diagrams in the previous examples imply that structures contain a lot of empty space. This picture is not entir

2017-09-09 09:43:57 150

翻译 Pointers on C——10 Structures and Unions.10

10.2.5 Accessing a Pointer MemberThe expression px->d gives the result you would expect—its R‐value is 0, and its L-value is the location itself. The expression *px->d is more interesting. Her

2017-09-09 09:43:20 151

翻译 Pointers on C——10 Structures and Unions.9

10.2.4 Accessing a Nested StructureTo access the member c, which is a structure, use the expression px->c. Its R‐value is the entire structure.为了访问本身也是结构的成员。我们可以使用表达式px->c 。它的左值是整个结构。

2017-09-09 09:42:51 146

翻译 Pointers on C——10 Structures and Unions.8

10.2.3 Accessing Structure MembersNow letʹs look at the arrow operator. The R‐value of the expression px->a isThe ‐> operator applies indirection to px (indicated by the

2017-09-09 09:42:23 172

翻译 Pointers on C——10 Structures and Unions.7

10.2.1 Accessing the PointerLetʹs begin with the pointer variable. The R‐value of the expression px is:让我们从指针变量开始。表达式px 的右值是:px is a pointer variable but there isnʹt any in

2017-09-09 09:41:50 216

翻译 Pointers on C——10 Structures and Unions.6

10.2 Structures, Pointers, and MembersThe operators for accessing structures and their members directly and through pointers are quite simple, but they can become confusing when applied in

2017-09-09 09:41:14 140

翻译 Pointers on C——10 Structures and Unions.5

10.1.5 Self-Referential Structures结构的自引用Is it legal for a structure to contain a member that is the same type as the structure?Here is an example to illustrate this idea.在一个结构内部包含一个类型为

2017-09-09 09:40:29 160

翻译 Pointers on C——10 Structures and Unions.4

10.1.4 Indirect Member AccessHow do you access the members of a structure if all you have is a pointer to it? The first step is to apply indirection to the pointer, which takes you to the

2017-09-08 08:58:39 177

翻译 Pointers on C——10 Structures and Unions.3

10.1.2 Structure MembersIn the examples so far, I have used only simple types for members. But any kind of variable that can be declared outside of a structure may also be used as a structure me

2017-09-08 08:57:29 176

翻译 Pointers on C——10 Structures and Unions.2

10.1.1 Structure DeclarationsStructures are declared by listing the members that they will contain. This list includes the type and the name of each member.在声明结构时,必须列出它包含的所有成员。这个列表包括每个成员的类型和名字

2017-09-08 08:56:53 135

翻译 Pointers on C——10 Structures and Unions.1

Data frequently exists in groups. For example, an employer must keep track of the name, age, and salary of each employee. Accessing these values is simplified if they can be stored together. However

2017-09-08 08:56:26 157

翻译 Pointers on C——9 Strings, Characters, and Bytes.11

​9.10 SummaryA string is a sequence of zero or more characters. The sequence is terminated by a NUL byte. The length of a string is the number of characters it contains. The standard library pro

2017-09-08 08:55:51 147

翻译 Pointers on C——9 Strings, Characters, and Bytes.10

9.9 Memory OperationsBy definition, a string is terminated with a NUL byte, so strings may not contain any NULs. However, it is not uncommon for nonstring data to contain zeros. You cannot use t

2017-09-08 08:55:17 127

翻译 Pointers on C——9 Strings, Characters, and Bytes.9

9.7 Error MessagesWhen calls are made to the operating system to perform functions, such as opening files, errors that occur are reported by setting an external integer variable called errno to

2017-09-08 08:54:50 122

翻译 Pointers on C——9 Strings, Characters, and Bytes.8

9.6.2 Finding TokensA string often contains several individual parts that are somehow separated from each other. To process these parts one at a time, you must first extract them from the string

2017-09-08 08:54:19 135

翻译 Pointers on C——9 Strings, Characters, and Bytes.7

9.6 Advanced String Searching高级字符串查找The next group of functions simplify the location and extraction of individual substrings from a string.接下来的一组函数简化了从一个字符串中查找和抽取一个子串的过程。

2017-09-08 08:53:50 178

翻译 Pointers on C——9 Strings, Characters, and Bytes.6

9.5 Basic String SearchingThere are many functions in the library that search strings in various ways. This wide variety of tools gives the C programmer great flexibility.标准库中存在许多函数,它们用各

2017-09-08 08:53:20 182

翻译 Pointers on C——9 Strings, Characters, and Bytes.5

9.4 Length-Restricted String FunctionsThe library includes several functions that deal with strings in a different way. This group of functions takes an explicit length argument that limit

2017-09-07 09:07:28 190

翻译 Pointers on C——9 Strings, Characters, and Bytes.4

​9.3.2 Concatenating StringsTo append (concatenate) one string to the end of another, strcat is used prototype is:要想把一个字符串添加(连接〉到另一个字符串的后面,你可以使用strcat 函数。它的原型如下:char *strcat(

2017-09-07 09:05:36 171

翻译 Pointers on C——9 Strings, Characters, and Bytes.3

9.3 Unrestricted String FunctionsThe most commonly used string functions are ʺunrestricted,ʺ meaning that they determine the length of their string arguments solely by looking for the term

2017-09-07 09:04:58 225

翻译 Pointers on C——9 Strings, Characters, and Bytes.2

9.2 String LengthThe length of a string is the number of characters it contains. The length is easily computed by counting the characters, as is done in Program 9.1. This implementation illustra

2017-09-07 09:04:31 193

翻译 Pointers on C——9 Strings, Characters, and Bytes.1

Strings are an important type of data, yet C does not have an explicit string data type because strings are stored in character arrays or as string literals. Literals are appropriate for strings tha

2017-09-07 09:03:39 115

翻译 Pointers on C——8 Arrays.22

8.4 SummaryThe value of an array name in most expressions is a pointer to the first element of the array. There are only two exceptions to this rule, sizeof returns the number of bytes i

2017-09-07 09:01:31 243

翻译 Pointers on C——8 Arrays.21

8.3 Arrays of Pointers指针数组Aside from its type, a pointer variable is like any other variable. Just as you can create arrays of integers, you can also declare arrays of pointers. Here i

2017-09-07 09:00:57 194

翻译 Pointers on C——8 Arrays.20

8.2.7 Automatic Array SizingWith multidimensional arrays, only the first dimensional of the array can be implied by the initializer list. The remaining ones are needed so that the compiler can d

2017-09-07 09:00:19 118

RTL9000的数据手册

RTL9000的数据手册

2023-11-10

YUNTU-MCAL-QSG-RTM-v1.1.0.pdf

YUNTU_MCAL_QSG_RTM_v1.1.0.pdf

2023-07-19

AUTOSAR-PRS-TimeSyncProtocol.pdf

AUTOSAR_PRS_TimeSyncProtocol.pdf

2023-07-19

AUTOSAR-PRS-E2EProtocol.pdf

AUTOSAR_PRS_E2EProtocol.pdf

2023-07-19

AUTOSAR-PRS-SecOcProtocol.pdf

AUTOSAR_PRS_SecOcProtocol.pdf

2023-07-19

AUTOSAR-PRS-NetworkManagementProtocol.pdf

AUTOSAR_PRS_NetworkManagementProtocol.pdf

2023-07-19

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除