Basic components:
Data Type: The data types of C include integer, character, real number or floating point (single precision and double precision), enumeration type, array type, structure type, * * object type, pointer type and null type.
Constants and variables: Constants have unchangeable values, and symbolic constant names are usually capitalized.
A variable is a quantity whose value can be changed under the name of an identifier. An identifier is a series of letters, numbers or underscores that begin with a letter or underscore. Please note that the first character must be a letter or an underscore, otherwise it is an illegal variable name. Variables are assigned corresponding storage locations at compile time.
Array: If the variable name is followed by a number bracket, the declaration is an array declaration. Strings are also arrays. They end the array with ASCII NULL. It should be noted that the index values in parentheses are counted from 0.
Pointer: If a variable is declared with an * in front of it, it indicates that it is a pointer variable. In other words, the variable stores an address, and * (especially monocular operator * here, the same below. There is also a binocular operator *) in C language, which is a content operator, meaning to take the content stored in this memory address. Pointer is one of the main characteristics that distinguish C language from other contemporary high-level languages.
Pointers can be not only the addresses of variables, but also the addresses of arrays, array elements and functions. Pointers can be used as formal parameters to get multiple return values in the process of function calling, unlike return(z) which can only get one return value.
String: The string in C language is actually a char array ending with the character' \0'. You don't need a reference library to use character types, but you need some functions in the C standard library to operate on strings. They are different from character arrays. Using these functions requires a reference to the header file.
Extended data:
Grammatical structure:
Sequence structure:
The programming of Sequence structure is the simplest, as long as the corresponding statements are written in the order of solving problems, its execution order is top-down.
Select structure:
Although the program of sequence structure can solve the problems of calculation and output, it can't be judged before selection. The selection structure should be used for problems that need to be judged before selection. The execution of the selection structure is to select the execution path according to certain conditions, not strictly according to the physical order in which the statements appear. The key to the programming method of choosing structure lies in constructing appropriate branching conditions and analyzing program flow, and choosing appropriate selection statements according to different program flow.
Circular structure:
Loop structure can reduce the workload of repeated writing in source program and can be used to describe the problem of repeated execution of an algorithm. This is the program structure that can give full play to the computer specialty in programming. C language provides four loops, which are goto loop, while loop, do while loop and for loop.
References:
Baidu encyclopedia -C language