First, the PTA laboratory work Title 1:7-5 Statistics Capital consonant letter 1. PTA Submission List
2. Design ideas (in code to deduct points) 3. Code 4. Problems encountered during debugging and PTA submission List status description. Topic 2:1. PTA Submission List 2. Design ideas (in code for deduction) 3. Code 4. Problems encountered in debugging process and PTA Submission List situation description. Topic 3:1. PTA Submission List 2. Design ideas (in code for deduction) 3. Code 4. Problems encountered in debugging process and PTA Submission List situation description. Second, this week's topic set PTA Final ranking. Third, peer code peer review 1. Mutual evaluation of the name of the students 2. My Code, mutual evaluation of the classmate Code 3. I and the classmate code is different where? What are the respective advantages? What style of code do you prefer? Iv. Study Summary of the Week 1. What did you learn? 1.1 How pointer variables are defined (design code can be rendered with markdown code symbols)?
- General form: type name * pointer variable name
- int *p,a=3; p=&a;
1.2 pointer addition operation in which case, can the 2 pointer variables be added to each other?
- Pointer p points to the variable value plus one:p=p+1, + +p, (p) + +,p++==(p++), is the value of *p as the value of the expression, and then the pointer p plus one, after the operation P no longer points to the original reference to the variable
- Two pointer variables cannot be added
1.3 The pointer does not assign the initial value, direct use, what happens, please use DEVC verification, and show?
- The pointer does not assign the initial value to use will cause the system to crash, see figure II
1.4 Lessons about separating the integer and fractional parts of a floating-point number, use DEVC to verify the implementation, and show it in this map, and also indicate which is the pointer variable to do the function parameter, and how the function argument should be represented. What is the use of pointer variables for function parameters? 1.5 Please change the bubble sort function of the textbook into a pointer variable to do the formal parameter format, and write the code at the bottom, pay attention to the markdown syntax rendering.
void bubble(int *p,intn) {int i,j,t;for(i=1;i<n;i++) for(j=0;j<n-i;j++) if(p[j]>p[j+1]) t=*p;*p=*(p+1);*(p+1)=t;}
1.6 How to define a pointer variable to an array, and how to use a pointer variable to represent an array element?
- Define the array first, P=A is the address of the pointer variable p that refers to the address of the array element a[0]
- P=a+1 equivalent to p=&a[1]
1.7 How do I define a character pointer to a string? Where is the initial position after the pointer points to the string?
- Type name * pointer variable name = "string"
- The initial position is the address of the storage unit that holds the first character of the string constant
1.8 Use a character pointer to manipulate strings, such as design functions, to implement string joins, and show the code in this map. What are the advantages of the method that indicates the pointer represents a character? 2. What is your content this week? 2.1 Class allocation and how to revise the wrong questions. 2.2 Others not? What are you going to do? 3. Array on-Machine exam summary 3.1 The wrong question, please list? 3.2 Wrong question How to revise, why wrong?
C Language Blog Job--character array