Home > Backend Development > C++ > Explain the format of C language

Explain the format of C language

WBOY
Release: 2023-09-06 20:01:07
forward
1307 people have browsed it

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

  • statement ends with a semicolon.
  • C case sensitive
  • Indentation is ignored by the compiler.
  • Strings are placed in double quotes.
  • Library functions are in lowercase.
  • Line breaks are processed by

  • >

Format of C language

The format of C programming language is explained as follows-

Semicolon

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.

Case Sensitive

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.

Comments are not required

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.

Sample program

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.

Example

#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 ( );
}
Copy after login

Output

When the above program is executed, the following results are produced -

Enter radius of circle 1
Circumference=6.2830
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template