The C Character Set
The C Character Set
To develop a program what fundament components are required those are called characteristics of C
The classical method of learning English is to first learn the alphabets used in the language, then learn to
combine these alphabets to form words, which in turn are combined to form sentences and sentences are
combined to form paragraphs. Learning C is similar and easier.
Letters : A to Z and a to z
Digits : 0 to 9
Special characters : *, @, # ......etc.
White space characters: Enter key(\n), tab space key(\t), space key (
−), back space key (‘\b’)....etc.
Token
Smallest individual unit of a program is known as token.
Keywords
Identifiers
Constants
Keywords, also known as reserved words, are a type of predefined words in C language that have
special meanings and purposes. There is a set of 32 keywords in C language,
1
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
Identifiers:
Identifier refers to the names of the variables, functions and arrays.
Here are some of the key differences between keywords and identifiers:
Keywords Identifiers
1. These are predefined and can not be used or defined These are user-defined for several
according to the user. operations.
4. Identifies a value that is already in the compiler Identifies a value that is user-
defined.
Data types
A data type specifies the values a variable may assume. Variable should be
associated with a single data type The C language provides the four basic
arithmetic type specifiers char, int, float and double,
1. Integer – We use these for storing various whole numbers, such as 5, 8, 67, 2390, etc.
2
2. Character – It refers to all ASCII character sets as well as the single alphabets, such as
‘x’, ‘Y’, etc.
3. Double – These include all large types of numeric values that do not come under either
floating-point data type or integer data type. Visit Double Data Type in C to know more.
4. Floating-point – These refer to all the real number values or decimal points, such as
40.1, 820.673, 5.9, etc.
5. Void – This term refers to no values at all. We mostly use this data type when defining
the functions in a program.
Various keywords are used in a program for specifying the data types mentioned above.
Here are the keywords that we use:
int Integer
float Floating-point
void Void
char Character
double Double
16 or 32
3
short int %hd -32,767 to 32,767 16
unsigned short %hu 0 to 65,535 16
int
signed short int %hd Same as short int 16
long int %ld, %li -2,147,483,647 to 2,147,483,647 32
long long int %lld, %lli -(263 – 1) to 263 – 1 (It will be added by the C99 64
standard)
signed long int %ld, %li Same as long int 32
unsigned long int %lu 0 to 4,294,967,295 32
unsigned long %llu 264 – 1 (It will be added by the C99 standard) 64
long int
float %f 1E-37 to 1E+37 along with six digits of the precisions 32
here
double %lf 1E-37 to 1E+37 along with six digits of the precisions 64
here
long double %Lf 1E-37 to 1E+37 along with six digits of the precisions 80
here
#include <stdio.h>
int main() {
return 0;
4
As we can see, we can use any of the smaller integer values in a char data type.
For instance,
For instance,
float y = 127.675;
float x = 1000.5454F;
Just like the data type int, we can also use the float data type along with various modifiers.
For instance,
double y = 424455236424564.24663224663322;
A person will utilise the double data type in a program only when it is needed to store any
such large numbers. Otherwise, we don’t use it as it will make the program very slow.
We can store the octal (or base 8), hexadecimal (or base 16), and decimal (or base 10) in
the data types.
For instance,
5
int z = 310;
z = -4260;
int z = 90U;
Character constants
String constants