C Language Syntax Basic Rules

C language syntax specifies rules to form statements like how to start line of code, how to end statement, where to use double quotes, etc.

It specifies rules to form character sequences that will be grouped together to form tokens. Tokens are the basic building units for the C program. Tokens may be identifiers, keywords, a constant, variable, symbol which has some meaning in C.

Some basic syntax rule for the C program

  • C is a case-sensitive language, therefore all C instructions must be written in lowercase letters.
  • All C statements must end with a semicolon.
  • Whitespace is required between keywords and identifiers.

Program to Illustrate Syntax Rules

// C program to illustrate Syntax rules
int main()
 printf("Hello, this is \"Scholarsoul\" \n");
 return 0;

Code explanation

The smallest individual unit is known as tokens. The rule specifies how to group characters to form tokens. In the above program if we take one statement, for instance, ” printf(“Hello, this is \”Scholarsoul\” \n”);” then tokens in this statements are…printf,(,”Hello, this is \” Scholarsoul\” \n”,),and ;. The semicolon(;) indicates the end of one statement. Comment lines are plain texts that are not compiled by a compiler. It is not compulsory to write, but it makes your code more descriptive. It begins with ‘//’ symbol or ‘/*’ symbol. The C program always begins with the main(). The statements in C are enclosed within curly braces({}).


Syntax rules in C

People also ask for

What is the basic syntax of C?

The basic syntax of C is to include header files, main function and program code. This is the most fundamental structure in the C program.