C language syntax specify rules for sequence of characters to be written in C language. In simple language it states how to form statements in a C language program. How should the line of code start How it should end, Where to use double quotes Where to use curly brackets etc.
The rule specify how the character sequence will be grouped together, to form tokens. A smallest individual unit in C program is known as C Token. Tokens are either keywords, identifiers, constants, variables or any symbol which has some meaning in C language. A C program can also be called as a collection of various tokens.
For example, the following C statement consists of five tokens −
printf("Hello, World! \n");
The individual tokens are −
printf
(
"Hello, World! \n"
)
;
Semicolons ;
In a C program, the semicolon is a statement terminator. Each statement which does not has its body (please note that, statement without its body) must be terminated by the semicolon (;). It indicates the end of one logical entity.
Given below are two different statements −
printf("Hello, World! \n");
return 0;
The statements which should be terminated
The statements which should not be terminated
Comments are plain simple text in a C program that are not compiled by the compiler. We write comments for better understanding of the program. Though writing comments is not compulsory, but it is recommended to make your program more descriptive. It make the code more readable.
There are two ways in which we can write comments.
Example of comments :
// This is a comment
/* This is a comment */
/* This is a long
and valid comment */
// this is not
a valid comment