CodePudding user response:
Do not useWhile (conditions)
Don't use more
While (portfolio)
To use the
While (1) {
Condition of an if (1) break;
//...
If conditions (2) continue;
//...
If conditions (3) return;
//...
}
Because the first two kinds of writing on the level of language to express meaning is ambiguous, is only the third faithfully reflect the actual situation of program flow,
Typical such as:
The following two paragraphs semantics are as at the end of the file not read characters
while (! The feof (f)) {
A=fgetc (f);
//...
B=fgetc (f);//may already feof!
//...
}
And write no problem like this:
While (1) {
A=fgetc (f);
If (feof (f)) break;
//...
B=fgetc (f);
If (feof (f)) break;
//...
}
Similar examples can also take a lot of,
CodePudding user response:
With braces, didn't understand the meaning of the building Lord, want to achieve? Rarely seen in the () with curly braces {}