Collation
Hope that you can give pointers to the brightest stars in the sky (*)
Online drive download: micro drive file format: xmind production software: Connotation of xmind pro pointer
The pointer variable is used to store the variable address. Since we use * to act on Pointer variables, the author prefers to treat pointers as stars. The author compares the pointer to a key (the key of the mailbox) and regards the variable value as a letter.
The name of the connotation array indicates the address of the first element of the array. Because the array variable stores the address of the first element, the array variable is also a pointer variable. However, the difference is that you cannot perform auto-increment (++) or auto-increment (--) operations on the array variables. Therefore, the array variables are called
Pointer constant . We can use [] or * to obtain the pointer to the value in the variable. Pointers (*) and arrays ([]) are interconnected. String Common Operations> String Length: strlen (str1); string replication: strcpy (str1 receiver, str2 receiver) strncpy (str1 receiver, str2 receiver, N replica count) string connection: strcat (DEST connector, source connector) strncat (DEST, source, n) string comparison: strcmp (str1, str2) str1 = str2 address comparison, used to determine whether str1 and str2 point to the same variable. The struct uses a pointer to access a member (*).
Struct is a derived data type. Struct is a collection composed of the same or different data types.
Common Code Define struct
TypedefStruct_ Student {CharName [10];IntScore;} student;
Allocate memory
Student * PTR = (student *) malloc (Sizeof(Student ));
File Operations
Int Main (){ Char Id [ 10 ]; File * Fptr; If (Fptr = fopen ( " Test. dat " , " A + " ) = Null) {printf ( " Unable to open test. dat " ); Return 1 ;} Do {Printf ( " Enter ID \ n " ); Scanf ( " % S " , ID); fprintf (fptr, " % S \ n " , ID );} While (Strcmp (ID," -1 " )! = 0 ); Fclose (fptr ); Return 0 ;}
Book errors
1. Section 4th (page 11) describes the struct in this way (see ). -- In fact, the struct is composed of the same or different data types.
2. (page 12) Is it an error I understand? From this sentence, I mistakenly believe that the struct members are adjacent in the memory. -- But not actually.
3. Page 53 (command line independent variables), which clearly indicates different meanings. How can we generalize them together?
Recommendation