1. The knowledge points learned in this lesson:
(1) Introduce character pointers and string processing by example "code Encryption". First, it focuses on the association and distinction between character pointers and strings, and then explains the common string processing functions, emphasizing the particularity of string operations and analyzing the reasons by comparing the examples.
(2) string constants use a sequence of characters enclosed in double quotation marks. Because strings are a string of characters, they are often treated as a special one-dimensional array of characters, similar to the storage of arrays, where all characters in a string constant are stored in memory. A string constant is essentially a pointer constant pointing to the first character of the string. Do not reference a pointer that is not assigned a value.
(3) When you define a pointer, you can first set its initial value to null, such as Char *s=null.
(4) input and output of strings: function scanf () and gets () can be used to input strings, while printf () and puts () output strings. They are defined in the system file stdio.h.
(5) String copy function char *strcpy (char *s1,char *s2)
String Join function strcat (S1,S2)
string comparison function strcmp (S1,S2)
String length function strlen (S1)
(6) The storage area of dynamic memory allocation is outside the user's program, not by the compilation system, but by the user in the program by dynamic allocation. Using dynamic memory allocation can effectively use memory, the same memory area can be used multiple times, when using the application, after the release.
2. Problems encountered during the experiment and solutions:
(1) Sometimes it is not very good to understand the meaning of the topic.
(2) Ask the teacher and classmates in time to check the information.
3. Experience of experiment and summary of the study in this chapter:
In this lesson, we learned about character pointers and strings. A string is a special type of char one-dimensional array. For this class, I feel I can learn, almost understand, but also understand some concepts. But continue to refuel!
Basic application of experimental 12--pointers 2