You are on page 1of 2

3/7/2022

Tokens
Basic Syntax  A token is either a keyword, an identifier, a constant, a
string literal, or a symbol.
 Eg. printf("Hello, World! \n");
 The individual tokens are:
printf
(
"Hello, World! \n"
)
;

Semicolons(;) Comments
 It is a statement terminator.  Comments are like helping text in your C program and
 Each individual statement must be ended with a they are ignored by the compiler.
semicolon.  Single line comment: //first program in c
 It indicates the end of one logical entity.  Multiline comment: /* first
 Eg. program
printf("Hello, World! \n"); in
return 0; C */
or
printf("Hello, World! \n"); return 0;

Identifiers Identifiers(Cont.)
 A C identifier is a name used to identify a variable,  Acceptable identifiers:
function, or any other user-defined item.  mohan zara abc
 An identifier starts with a letter A to Z or a to z or an  move_name a_123 myname50
underscore _ followed by zero or more letters,
 _temp j a23b9
underscores, and digits (0 to 9).
 retVal
 C does not allow punctuation characters such as @, $,
and % within identifiers.
 C is a case sensitive programming language.
 Eg. int money;
 Here, money is identifier.

1
3/7/2022

Keywords
 They are reserved words in C.
 These reserved words may not be used as constant or
variable or any other identifier names.
 Eg. int money;
 Here, int is keyword.

Whitespace Q&A
 Whitespace describes blanks, tabs(\t), newline(\n)  abc@12
characters.  xyz!
 Whitespace separates one part of a statement from  Smith
another and enables the compiler to identify where one
 S09
element in a statement, such as int, ends and the next
element begins.  A_b
 Eg. int age;  $abc
 12ab
 float
 break

You might also like