Learn basic components of C language.

Every language has some set of grammatical rules and basic elements. Before starting it is mandatory to know the primary elements of the language. These basic components of C language are variables, character sets, constants, keywords (reserved words), database, expressions, variable declaration, statements, etc. These are the basic components to construct a C program.

Data in C

In life of a file execution,

  1. The data which does not change with time are constants. Eg. Name, Date of birth, Year of passing.
  2. The data which changes with time are variables. (Which are also called Identifiers, Means must be declared) Eg. Age, Contact no.

Character constants: ‘A’, ‘*’, ‘5’, ‘8’, …

Integer constant: 567, -1, 8, 0x123, 0125, …

Real constant: 5.23, -0.001, 5.6E+3, …

String constant: “Electronics1010”, “A”, …

basic components of c language

These are the character are allowed in C programs

Uppercase and Lowercase letters

A, B, C, D ……….. Z

a, b, c, d ……….. z


0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Graphic characters

+Plus sign-Minus sine (Hyphen)
\Backward slash/Forward slash
%Percent sign*Asterisk
{Left Braces}Right Braces
[Left Bracket]Right Bracket
(Left Parenthesis)Right Parenthesis
Less than sign=Equal to sign
>Grater than sign_Underscore
'Single Quotes"Double Quotes
?Question mark!Exclamation sign
&Ampersand^Caret sign
~Tilde sign|Vertical bar

Whitespace characters

Newline character, Space character, Vertical tab, Horizontal tab, and form feed are whitespace characters.

Other characters

Backspace, Carriage return, alerts, and null character.

Escape Sequences

Some character sets newline, tab, backspace are cannot be displayed on a screen like normal characters.

C supports the combinations of backslash ( / ) and characters to represents these characters in our program. These combinations are known as escape sequence.

Some escape sequences are given below,

Escape SequenceMeaningPurpose
\bbackspaceMoves the cursor to the previous position of the current line.
\aalertProduces an audible or visible alert
\rcarriage returnmoves curser to the beginning of the line
\nnew linemoves curser to the beginning of the next line
\fform feedMoves the curser to the initial position of the next logical page
\0null characterUsed for termination of character string
\vvertical tabMoves the cursor to next vertical tab position
\thorizontal tabMoves the cursor to next horizontal tab position
\\backslashPresents a character with backslash ( \ )

Blank, vertical tab, horizontal tab, carriage return, newline, form feed are known as whitespace in C language.

Trigraph Character

Some keyboards are not having all the characters from the C character set. So as a solution C supports the facility of “trigraph sequence” to print these characters.

Trigraph SequenceSymbol
??{ Left brace
??>} Right brace
??([ Left bracket
??)] Right bracket
??!| Vertical bar
??/\ Backslash
??=# Hash sign
??-~ Tilde
??'^ Caret


Delimiters are very important and they are used for syntactic purpose in C.

:Colonused for label
;Semicolonend of the statement
( )Parenthesesused in expression
[ ]Square bracketsused in array
{ }Curly bracesused for block of statements
#Hashpreprocessor directive
,Commavariable delimiter

NOTE: In C language every word we write, it is either a keyword or Identifier.


  • The word which is meaningful to the compiler is known as a keyword.
  • Keywords are having its specific meaning, and the meaning can not be changed.
  • In C language we are having 32 keywords.
  • It is always written in lowercase only.
NOTE: Functions are not keywords.


An identifier is nothing but a name assigned to an element in a program.

Example: name of a variable, function, etc.

Identifiers are the user-defined names consisting of ‘C’ standard character set. As the name says, identifiers are used to identify a particular element in a program. Each identifier must have a unique name. Following rules must be followed for identifiers:

  1. The first character must always be an alphabet or an underscore.
  2. It should be formed using only letters, numbers, or underscore.
  3. A keyword cannot be used as an identifier.
  4. It should not contain any whitespace character.
  5. The name must be meaningful.


Valid identifiers:

  • Result
  • sum
  • a
  • total_value
  • _temp
  • DATA

Invalid identifiers:

  • 2data : First character should be an alphabet or underscore.
  • int : int is a keyword.
  • sum# : # is a special character.
  • total value : blank space is not permitted.


Token: Whatever known to compiler OR meaningful to the compiler is known as a token.

TOKEN is the smallest unit in a ‘C’ program.

It is each and every word and punctuation that you come across in your C program.

The compiler breaks a program into the smallest possible units (tokens) and proceeds to the various stages of the compilation.

A token is divided into six different types, Keywords, Operators, Strings, Constants, Special Characters, and Identifiers.

Data type

Every datatypes are keywords but not vice-versa

Different datatype is different in memory.

  1. Primary (Built-in) data type
  2. Derived data type
basic components of c language

All character and integer types are known as integral types, and the types float, double, long double are known as floating point type.

The size and range of different datatypes are machine and compiler dependent.


datatype variable_name;


char v1;
int _count;

We can use sizeof() operator to find out the size of different datatype on our system.

Primary (Built-in) data type


Sine qualifiers: Signed, Unsigned

Size: 1 byte

Size of character variable always will be 1 byte.


Integer variable size will be 2 (or) 4 bytes, which depends upon the platform.

Sine qualifiers: Signed, Unsigned

Size qualifiers: Short, long, long long


  • short int : 2 bytes
  • long int : 4 or 8 bytes
  • long long int : 8 or 16 bytes


Size : 4 bytes


Size Variations : long

Size :

  • double : 8 bytes
  • long double : 8 or 10 bytes


Void indicates that no value is available. void should be used to declare only pointers not for variables.

Basic data typesData types with type qualifiersSize (bytes)Range
charsigned char1-128 to 127
unsigned char10 to 255
intint or signed int2- 32768 to 32767
unsigned int20 to 65535
short int or signed short int1-128 to 127
unsigned short int10 to 255
long int or signed long int4-2147483648 to 2147483647
unsigned long int40 to 4294967295
floatfloat43.4E-38 to 3.4E+38
doubledouble81.7E-308 to 1.7E+308
long double103.4E-4932 to 1.1E+4932

Derived data type

Derived data type we look in detail in other article but for your reference just look for its types.

Enum, Pointer, array, structure, union are derived datatype

NOTE: int the next tutorial we will learn how to check of your system's variable size. 


  1. Revise the compilation stage part 1
  2. Revise the compilation stage part 2

Leave a Comment