Write the name of the main () function incorrectly, a C program must have a main () function, and case-sensitive.
The main () function forgot to return the value, normally the main () is written with an int as the return value, so in main () you need to return an integer data, the default return 0
The string in the printf () function is not enclosed in double quotation marks when writing a C program, characters other than the string contents should be entered using the English input method
Character form |
Function |
' \ r ' |
added a return key. |
' \ n ' |
followed by a newline. |
| ' \ t ' (table) |
Tabs (with several spaces in the middle) |
‘\\‘ |
Reverse Slash |
‘ \‘ ‘ |
Single quotation marks |
‘ \" ‘ |
Double quotes |
' + ' |
Empty characters (not spaces) |
Identifiers |
Output category |
Example |
Results |
%d |
Integral type |
printf ("%d", 5); |
5 |
%f |
floating point |
printf ("% F ", 5.5); |
5.5 | /tr>
%. n Floating-point number, reserved n decimal |
printf ("%.2f", 3.1415926); |
3.14 | /tr>
% m . N F |
floating-point number retention N Decimal Place and before the decimal point with the total m bit alignment (M doesn't make sense) |
printf ("%3.2f", 3.1415926); |
3.14 |
%c |
Character Type |
printf ("%c", ' a '); |
A |
-for example a squared root minus B of the square root writing sqrt (a)-sqrt (b) sqrt () for the square root function-square pow (m,n)//number of N-square of a certain m. -the remainder of two numbers can be divided by using the% operator% also known as the modulo operator such as a% B (for two integer int, not for floating-point type)
C Language Common errors