C Character Set
C language also has a set of
characters which include alphabets, digits, and special
symbols. C language supports a total of 256 characters.
C language character set contains the following set of characters...
1.
Alphabets
2.
Digits
3.
Special Symbols
Alphabets
C language supports all the alphabets from
the English language. Lower- and upper-case letters together support 52
alphabets.
Lower case letters - a to z
UPPER CASE LETTERS - A to Z
Digits
C language supports 10 digits which are used
to construct numerical values in C language.
Digits - 0, 1, 2, 3, 4, 5, 6, 7,
8, 9
Special Symbols
C language supports a rich set of special
symbols that include symbols to perform mathematical operations, to check
conditions, white spaces, backspaces, and other special symbols.
Special Symbols - ~ @ # $ % ^
& * ( ) _ - + = { } [ ] ; : ' " / ? . > , < \ | tab newline
space NULL bell backspace vertical tab etc.,
Every smallest individual unit of a
c program is called token. Every instruction in a c program is a collection of
tokens. In a c program token may contain the following...
1.
Keywords
2.
Identifiers
3.
Operators
4.
Special Symbols
In a C program, a
collection of all the keywords, identifiers, operators, special symbols,
constants, strings, and data values are called tokens.
C Keywords
Keywords are special
words with predefined meaning.
Keywords are also known as reserved words in C
programming language.
In the C programming language, there are 32 keywords.
C Identifiers
Programmers can
specify their name to a variable, array, pointer, function, etc... An
identifier is a collection of characters which acts as the name of variable,
function, array, pointer, structure, etc... In other words, an identifier can
be defined as the user-defined name to identify an entity uniquely in the c
programming language that name may be of the variable name, function name,
array name, pointer name, structure name or a label.
Example
marks;
student_Name;
Here, marks and student_Name are identifiers.
Rules for
Creating Identifiers
1.
An identifier can
contain letters (UPPERCASE and lowercase), numeric & underscore symbol
only.
2.
An identifier should not
start with a numerical value. It can start with a letter or an underscore.
3.
We should not use any
special symbols in between the identifier even whitespace.
4.
However, the only
underscore symbol is allowed.
5.
An identifier must be
unique in its scope.
C
Variables
Variables in a c
programming language are the named memory locations where the user can store
different values of the same data type during the program execution.
A variable name may contain letters,
digits and underscore symbol. The following are the rules to specify a variable
name...
1.
Variable name should not
start with a digit.
2.
Keywords should not be
used as variable names.
3.
A variable name should
not contain any special symbols except underscore (_).
4.
A variable name can be
of any length but compiler considers only the first 31 characters of the
variable name.
Example
int
number;
The above declaration tells to the compiler
that allocates 2 bytes of memory with the name number and
allows only integer values into that memory location.
C
Constants
In C programming
language, a constant is similar to the variable but the constant hold only one
value during the program execution. That means, once a value is assigned to the
constant, that value can't be changed during the program execution. Once the
value is assigned to the constant, it is fixed throughout the program. A
constant can be defined as follows...
Const a=40;
0 comments:
Post a Comment