- Introduction to C
- Introduction to C
- Program Structure
- Basic Syntax
- Data Types
- Storage Classes
- If statements
- Case control statements
- File I/O
- Type Casting
- Command line arguments
- Header Files
- Dynamic memory allocation
- Error Handling
As we have seen about basic structure of C program , it will be easy for us to understand other basic building blocks of this language.
Tokens in C:
There are various tokens in C language which can be either a keyword, literal , identifier, symbol and a constant.
Below is the following C statement that consists of five tokens which are as :
The individual tokens are:
Semicolon is called a statement terminator in C language. This means that each statement in C language must end with a semi colon. This indicates the end of one logical entity.
Below are the two statements as an example for a better understanding:
In C language comments are very useful and they are like helping text. These are ignored by C compiler.These start with /* and ends with */ as shown below:
- In C language any user-defined item, variable, function are recognized by identifiers.
- An identifier consists of letter A to Z, a to z, underscore_ followed by 0 or more letters, underscores and digits 0 to 9.
- Within identifiers punctuation characters such as @, $ and % are not considered.
- The most important thing to remember for C language is that it is a case-sensitive.
- For example: Manpower and manpower are two different identifiers in C language.
- List of some acceptable identifiers are given below:
Below is the list of various reserved words used in C language. These reserved words can't be used as a constant or variable or any other identifier names.
Wide space in C:
i. The term called blank line in C is a line that contains only wide space, possibly with a comment.
ii. In C wide space is the term used to describe blank spaces, tabs, newline characters and comments.
iii. Wide space is used to separate one part of statement from another and enables the compiler to identify where one element in a statement, such as int, ends the next line begins.
iv. Therefore, in the below statement:
It is easy for compiler to distinguish between int and age if there is at least one white space character. On the other hand in the following statement:
There is no wide space needed between fruit and =, or between = and apples, but for easy reading one is free to include.