-
The following are the structural features of the C language,1A C source program can consist of one or more source files.
2.Each source file can consist of one or more functions.
3.No matter how many files a source program consists of, it has one and only one main function, that is, the main function.
4.There can be preprocessing commands in the source program (the include command is only one of them), and the preprocessing command should usually be placed first in the source file or source program.
5.Every description, every statement must end with a semicolon. However, preprocessing commands, function headers and curly braces "}" cannot be followed by semicolons (with the exception of structs and nulls).
6.Identifiers, keywords must have at least one space between them to indicate the interval. If there is already an obvious spacer, you can also no longer add a space to separate it.
Among them, what was said upstairs cannot be written in capital letters, and I do not agree with it.
It's not that you can't use uppercase, but in general, C language is customary to only use uppercase when defining macros.
Other variables can also be used, there are no grammatical errors, but everyone does not write it this way, and it is customary.
Another thing that is not mentioned upstairs is that C must declare the type of variable.
This is very empty, but also very abstract, must be combined with case analysis, it is recommended that you take a book to study systematically (recommended C primer plus).
-
There's only one rule, and it's to conform to the syntax of C.
1) The C source program consists of a main function and several other functions. (2) There must be parentheses after the function name, and the function body must be placed in curly brackets. (3) C programs must be written in lowercase letters.
4) Add a semicolon at the end of each sentence. (5) It can be more than one sentence. (6) You can have more than one sentence in one sentence.
7) You can annotate anywhere in the program. A complete C program is composed of a main() function (also known as the main function) and several other functions, or just one main() function.
-
If it can be compiled, it means that the rules are complied with.
-
From the point of view of writing clearly, it is crude from the point of view of reading, comprehension, and maintenance, when writing programs.
The following rules should be followed:
1.A description or statement occupies a line.
2.The part enclosed by {} usually represents a certain hierarchy of the program. Sannai {} is generally aligned with the first letter of the structural statement and occupies a separate line.
3.A statement or description at a lower level can be written after indenting a few squares than a statement or description at a higher level. so that it looks clearer and increases the readability of the program. When it comes to programming, you should strive to follow these rules in order to develop a good programming style.
Where there are spaces, you can wrap lines! if(abec
And. if(a
BEC is exactly the same.
-
It's not something that can be explained clearly in one or two sentences, just like English grammar, just buy a textbook and practice it.
-
1. Generally, when joining a group, first go to the group space, group forum, or group file to inquire about the group's overview, and some groups with limited backgrounds (such as anime or game fandom) will display the group rules and settings in the group announcement. [This is the basic of the basics, first of all, we must have a preliminary understanding of the group rules, background, and characters of a group before we can speak C
Second, to choose a job and change your name, you first need to fill in the character settings for the original Xiang C.
After understanding the background of the group and the basic settings of each character, choose the character you want to play, which is the so-called phi. 】
3. Join the group and enter the play. [This rule means that all speeches made in the group must be based on the group background and the characters played by the person, and there are some who are not part of the group, which can be determined according to the situation.] 】
Fourth, the belt sleeve is broken. [Breaking skin refers to mentioning topics in the group that are not related to the theme of the group, such as: The play in the group next door is good; Or pull it to the third dimension.
For example: my phone is out of battery, and so on. However, with the strengthening of the requirements of the group, many groups have attached water chat groups, so the main group prohibits all topics that are not related to the group. 】
5. Pay attention to the supracutaneous sex. [It has nothing to do with the ontology, it is the gender of the role in the group you are in.] 】
6. The forum in the group shall not be copied for other purposes. This is the default rule
Each group has its own spirit and principles, so things in other groups cannot be copied. It's respect for that group, responsibility for oneself, and the principle of language c.
Others have different levels of requirements according to the group rules. And the above points are the rules that a group should have in the absence of group rules.
Supplementary notes on the third point, joining the group and joining the play.
All speeches made in the group should be based on the group background and the characters you play
That is. Substitute yourself in the role you play in the process of language c].
On the surface, it seems that it is enough to speak by the identity of the role you play. (This is one of the more serious misunderstandings among newcomers).
In fact, it is not so simple to substitute oneself into the role being performed in the process of language C. The linguistic fetishness of the characters played, the fetishness of the mouth, the salutation of other characters (especially "The Governess").
Because it involves ten years later, it is necessary to pay special attention to the names of characters in different periods) does not seem to matter, and even many newcomers who have just entered the circle often shout "In the play!" None of this matters! But it's a very important point.
-
1) The C source program is composed of a main function and several other functions.
(2) There must be parentheses after the function name, and the function body must be placed in curly brackets.
(3) C programs must be written in lowercase letters.
4) Add a semicolon at the end of each sentence.
5) Multiple sentences can be hidden in one state.
(6) You can have more than one sentence in one sentence.
7) You can annotate anywhere in the program.
A complete C program is composed of a main() function (also known as the main function) and several other functions, or just one main() function.
-
In the source program, many symbols appear in pairs, so in order to avoid missing the symbols that must be paired, these start and stop identifiers can be entered consecutively when entering, and then inserted into them to complete the content. Although the writing format of C language programs is very free, from the perspective of clear program structure, easy to read, understand, and maintain, it is recommended that the following rules should be followed when writing programs to develop good programming habits.
1) A description or a statement occupies one line.
2) the part enclosed by curly braces, which usually indicates a certain hierarchy of the program, and the left curly brace is generally aligned with the first letter of the structure statement and occupies a separate line; The closing curly brace also occupies a separate line, aligning with the opening curly brace at the beginning of the structure.
3) Lower-level statements or instructions can be indented by a few squares (usually 2 or 4 spaces) than higher-level statements or descriptions to make them appear clearer and enhance the readability of the program.
-
This is too long, you can find a book for yourself, and recommend the C language programming tutorial of Tsinghua University Press.
-
It's easy.
The % rule in C is that "the sign of the remainder is the same as the sign of the dividend", just remember that. Of course, the absolute value of the remainder should be less than the absolute value of the divisor, which is a mathematical principle.
So: -23%-5, the dividend is -23, and the remainder is also a negative number, and the result is 4 remainder -3;
34%60, the remainder is negative, so the result is 0 more than -344% -3, and the remainder is positive, so it is -1 and 1
4%3, the remainder is negative, so it is -1 remainder -1
-
% to find the remainder.
13 % 2 is 6 and 1 is 1
-
The rule is that it must be an integer.
Scope. You static char *chh;
static char *ch1;Although the address pointed to by the two pointers does not change, have you ever wondered whether the memory address they point to has been released, char chc[10]; It's local, the function is out, the lifecycle is over, and you're trying to access it with a pointer in void times(). >>>More
Indicates that the remainder of 6 is taken.
In the C language, % stands for remainder (or modulo operation). >>>More
Valid variable names for the C language:
First, it can only contain numbers, letters, and underscores. >>>More
First, 3 linklist types list, p, and r. are declaredYou can think of list as a table, but at the beginning it is an empty table, list is assigned to r, start a for loop, specify the next node of r as p (head node), and then assign p to r, the next node of the head node is list, list is assigned to p, enter a from the keyboard, if a > 0, then the data part of the second node is the value of a, and the cycle continues, and the condition for the end is to enter the value a>=0, when p is sure to reach the last node after the while loop ends, p is assigned to r, r is the end node, and then output with do while, output the data of each node, and the end condition is p to the end node. To put it bluntly, first create an empty table k-1 node, then input the keyboard to assign the value of the data part of each node to "0", and finally output the input value.
It seems that you don't know much about structs and struct pointers, the data array is a struct array that you define, it consists of two knot body elements, and each struct element contains two members x and y, the first element is 1 and 10, the second element is 2 and 20, the struct pointer p you defined starts to point to the first element of the array data, p points to the second element of the data array, and the pointer p can manipulate the two members x and y >>>More