Home > Article > Backend Development > Explain the format of C language
C programming is a general-purpose, procedural, and imperative computer programming language. In C language, we see that the
The format of C programming language is explained as follows-
Semicolon is very important in C language.
It tells the compiler where one statement ends and the next statement begins.
If we fail to place a semicolon after each statement, you will receive a compilation error.
C is a case-sensitive language. Although int compiles, "Int", "INT" or any other variant does not work in C.
All C keywords are lowercase.
Although comments are not important, it is a good practice to add comments at the beginning of a program that indicate the purpose of the program, such as the author and the person who wrote it date.
The following is a C program that uses the C format method to calculate the circumference of a circle -
The formula for the circumference of a circle = 2*PI*R. p>
Among them, R is the radius of the circle, PI is a constant, and the value is PI3.415.
#include<stdio.h> //library function are lower case #include<conio.h> #define PI 3.1415 main ( ){ float c, r; //statements are terminated with semicolon printf ("enter radius of circle"); //strings are placed in double quotes scanf ("%f", &r); c = 2 * PI * r; printf ("Circumference = %f", c); getch ( ); }
When the above program is executed, the following results are produced -
Enter radius of circle 1 Circumference=6.2830
The above is the detailed content of Explain the format of C language. For more information, please follow other related articles on the PHP Chinese website!