0% found this document useful (0 votes)
47 views1 page

C Tokens Study Notes

C tokens are the smallest meaningful elements of a C program, categorized into keywords, identifiers, constants, strings, operators, and special symbols. Examples include reserved words like 'int', user-defined names like 'main', and fixed values like '10'. An example program illustrates the use of these tokens in a simple C program.

Uploaded by

kalaivanant
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)
47 views1 page

C Tokens Study Notes

C tokens are the smallest meaningful elements of a C program, categorized into keywords, identifiers, constants, strings, operators, and special symbols. Examples include reserved words like 'int', user-defined names like 'main', and fixed values like '10'. An example program illustrates the use of these tokens in a simple C program.

Uploaded by

kalaivanant
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

C Tokens - Study Notes

What is a Token?

A token in C is the smallest meaningful element of a C program.

Types of C Tokens

No. Token Type Description Examples

1 Keywords Reserved words in C int, float, return, if

2 Identifiers User-defined names main, sum, totalMarks

3 Constants Fixed values that do not change 10, 'A', 3.14

4 Strings Characters in double quotes "Hello", "C language"

5 Operators Symbols that perform operations +, -, *, ==, >=

6 Special Symbols Used in syntax/structure ;, {}, #, (), []

Example Program Showing Tokens:


#include <stdio.h> // Special symbol, keyword, string

int main() { // Keyword, identifier, special symbols


int num = 10; // Keyword, identifier, constant, operator
printf("Value: %d", num); // Identifier, string, special symbols
return 0; // Keyword, constant, special symbol
}

You might also like