Array:
Definition: Data type array name [number of array elements] = {value 1, value 2,....}
Essence: Quickly define multiple variables of the same data type
The disadvantage of arrays: variables that are defined by the same data type.
Such as:
int c[5] = {0};//The number of elements of the given array, you can follow the pattern, all assigned the initial value is zero
int a[] = {4, 5, 6};//in the absence of the given array element number, you can follow the pattern, at this time, be sure to write clear all the initial value.
Access to array elements:
By the array name and subscript to access such as: a[1], cut down the mark from the beginning of the zero.
Note : 1, The subscript of the last element of the array is : number of array elements -1;
2, C language, does not detect array subscript out of bounds.
Array traversal: The process of taking the elements of an array one by one, followed by an array subscript.
Rule: array[i], if there is no assignment symbol "=" on the right, then it is a procedure to take the value in the array; If the right side has an assignment symbol "=", then it is a process of re-assigning a value to an element in the array.
The string is an array, but the character array is not necessarily a string.
%s starts output from the first character of the string until it encounters A/s end output
String manipulation functions:
1. function for calculating the length of the string: strlen (), and the length of the string to be seen by the naked eye;
2. String copy function: strcpy (char *,const char *), copy the latter content to the previous string;
Note: The latter string length cannot exceed the previous string length
3. String concatenation function: strcat (char *,const char *), stitching the latter string behind the previous string (starting with the position of the former string);
4. String comparison function: strcmp (const char *,const char *), compares the previous string and the latter string one after the other until the end of a character that is not equal, and returns the difference between the previous string and the next string unequal character ( The characters in the previous string minus the characters in the latter string)
C Language IV: one-dimensional arrays, character arrays