0% found this document useful (0 votes)
41 views9 pages

C Tokens

Uploaded by

Illegal school
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views9 pages

C Tokens

Uploaded by

Illegal school
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

❖ 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.
Keywords Identifiers Constants Strings Special Operators
Symbols
✔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

Constants

Numeric Character
Constants Constants

Single
Integer Real character String
Constants Constants constants constants
✔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

You might also like