Lecture Note-01-1
Lecture Note-01-1
All the characters which can appear in a valid C program is called as Character Set of
C.
Alphabets : A-Z, a-z
Digits : 0-9
Special Characters : comma, semicolon, * etc.
Escape Sequence :
These are non-printing characters which instruct the computer to take certain action.
They consist of a backslash followed by a letter.
\b Back space
\n New line
\t Horizontal tab
\” Double quote
\v Vertical tab
\a Alert or bell
Identifiers in C language:
• An identifier is used to designate program elements like variables, constants, array
names, function names.
Rules for constructing identifiers :
• First character should be an alphabet or underscore.
• Succeeding characters might be digits or letters.
• Punctuation and special characters are not allowed except underscore.
• Identifiers should not be keywords.
• Identifier can have maximum 31 characters (ANSI C standards)
Keywords in C language:
• Keywords are pre-defined words in C.
• They are also called as reserved words.
• Their meaning is already known to the compiler.
• Each keyword is meant to perform a specific function in a C program.
Data Types
• Primary Data Types (Basic Types)
• Derived Data Types (Secondary Types)
A constant is an entity that doesn’t change whereas a variable is an entity that may change.
Variables
Variable names are names given to locations in memory. These locations can contain integer,
real or character constants.
In any language, the types of variables that it can support depend on the types of constants that
it can handle. This is because a particular type of variable can hold only the same type of
constant. For example, an integer variable can hold only an integer constant, a real variable can
hold only a real constant and a character variable can hold only a character constant.
data-type variable;
Example :
int x;