In C programming language there are some rules for writing programs. And there are some rules that are specified by C to write sequence of characters. In C programming language the smallest unit is called token. A token can be an identifier, keyword, constant, or a variable. We can also refer a C program as a collection of tokens.
The C language syntax rules are used to specify that how the sequence of characters will be grouped together to form token. The following are some of the tokens in C programming language: int, delimiters, comments, semi colon etc.
Comments are the lines of program that are not executed. The compiler ignores comments and does not include them in the executable program. That is why the comments do not affect the size of executable program.
Comments are used to increase the readability of the program. Comments are notes about different lines of code that explain the purpose of code. The user can insert information notes in the code. It helps in debugging and modifying the program later.
Comments can be added anywhere in the program or code.
Comments are of two types:
Comments on single line are added by using double slash “//”. Anything written on the right side of the double slash is considered as comments and is ignored during execution.
Multi line comments are inserted to the code by placing /* at the beginning of the comments. The character */ is used to end the multi line comments.
Following line is an example of single line comment:
//practice makes a man a good programmer.
Another way to add comments on a single line is as follows:
/* these are also comments…*/
In order to add comments on multiple lines in program, following way is used:
/*these lines are
For the purpose of
The following are some basic rules for C program:
- All the instruction and name of the functions etc should be written in lowercase because C is a case sensitive language.
- The C statements must be ended with a semi colon.
- In C programming language we use whitespace for blanks and tabs.
- The white spaces are required in between keywords and identifiers.
Consider the following labeled figure of a C program: