Explain the Format of C language

C programming is a general-purpose, procedural, imperative computer programming language developed by Dennis Ritchie at Bell Labs in the early 1970s. The C language follows a specific format and syntax rules that must be adhered to for successful compilation and execution.

Key Formatting Rules in C

The C programming language follows these essential formatting conventions −

  • Statements are terminated with semicolons (;)
  • C is case sensitive
  • Indentation is ignored by the compiler but improves readability
  • Strings are placed in double quotes ("")
  • Library functions and keywords are lowercase
  • Newlines are handled via
    escape sequence

Syntax

#include <header_files>
/* Optional: Global declarations */

int main() {
    /* Variable declarations */
    /* Program statements; */
    return 0;
}

Semicolons

Semicolons are statement terminators in C. They tell the compiler where one statement ends and the next statement begins. Missing semicolons result in compilation errors.

Case Sensitivity

C is a case-sensitive language. Keywords like int, main, and printf must be written in lowercase. Variations like Int, INT, or Main will cause compilation errors.

Comments

Comments are not mandatory but are considered good programming practice. They help document the program's purpose, author, and creation date. C supports two types of comments −

  • /* Multi-line comments */
  • // Single-line comments (C99 standard)

Example: Circle Circumference Calculator

The following program demonstrates proper C formatting while calculating the circumference of a circle using the formula: Circumference = 2 × ? × radius

#include <stdio.h>  /* Library functions are lowercase */
#define PI 3.1415   /* Constant definition */

int main() {
    float circumference, radius;  /* Statements terminated with semicolon */
    
    /* Strings are placed in double quotes */
    printf("Enter radius of circle: ");
    scanf("%f", &radius);
    
    /* Calculate circumference */
    circumference = 2 * PI * radius;
    
    printf("Circumference = %.4f<br>", circumference);
    
    return 0;  /* Program termination */
}

Output

Enter radius of circle: 1
Circumference = 6.2830

Key Points

  • Every C program must have a main() function as the entry point
  • Header files like <stdio.h> provide necessary function declarations
  • Proper indentation makes code readable but doesn't affect compilation
  • All C keywords and standard library functions are in lowercase

Conclusion

Following proper C formatting rules is essential for writing clean, readable, and error-free code. Understanding semicolon placement, case sensitivity, and comment usage forms the foundation of effective C programming.

Updated on: 2026-03-15T13:33:23+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements