C tokens

Manu1325 26,935 views 10 slides Apr 04, 2014
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

C tokens in C programming


Slide Content

C TOKENS

Introduction To C Tokens In a passage of text, individual words and punctuation marks are called tokens. Similarly, in C programming the smallest individual units are known as C tokens. C language has six types of tokens, and programs are written using these tokens and the syntax of the language.

Types Of C Tokens

Keywords serves as the building blocks for a program statements. All keywords have a fixed meaning and cannot be changed. Keywords cannot be used as normal identifier names. Few Examples of keywords used in C are listed below int break goto char switch void

Identifier refers to the name of variables, functions and arrays. These are user defined names and consists of a sequence of letters and digits. Both uppercase and lowercase letters can be used, and c language is case sensitive. A special symbol underscore ( _ ) is also permitted. Rules For Identifiers First character must be an alphabet. must consist of only letters, digits or underscore. Should not be a keyword and should not have any blank space. Example:- int num; char name; Where num and name are identifier names.

Constants refers to fixed values that do not change during the execution of a program. Basic types of C constants are shown in the flowchart

Strings are nothing but array of characters ended with null character (‘\0’). This null character indicates the end of the string. Strings are always enclosed by double quotes. Whereas, character is enclosed by single quotes in C. Example :- char name[10]; In this example the variable name can store up to 10 bytes.

The following special symbols are used in C having some special meaning and thus, cannot be used for some other purpose. [] () {} , ; : * … = # Braces{}:  These opening and ending curly braces marks the start and end of a block of code containing more than one executable statement. Parentheses():  These special symbols are used to indicate function calls and function parameters. Brackets[]:  Opening and closing brackets are used as array element reference. These indicate single and multidimensional subscripts.

The symbols which are used to perform logical and mathematical operations in a C program are called C operators. Operators used in C program are Arithmetic operators Assignment operators Relational operators Logical operators Bit wise operators Conditional operators (ternary operators) Increment/decrement operators Special Operators

THANK YOU
Tags