#2 Identifiers in C Language PDF
#2 Identifiers in C Language PDF
#2 Identifiers in C Language
By Saurabh Shukla | 2017©mysirg.com
Begin Learning C
Computer languages are like natural languages. Natural languages like Hindi, English, and German
are used for the communication between human beings. Computer languages are used to prepare a
script to perform actions by the machines.
Language is just a medium to express your thoughts. When we want to say something to a machine
to do some task, we just trigger the script (program) by clicking on some file or clicking on some
button or may be hitting some key on the keyboard. This script or program is prepared in some
computer programming language.
Developing program is the job of programmer. You need to learn language to become a
programmer.
Learning steps are very similar to the process you must have gone through at early stages of your
schooling. When you were a kid, you were supposed to learn alphabets in English. Swar and vyanjan
in Hindi. In the same way you have to begin learning C language.
You are already familiar with the basic letters as you have seen them on keyboard. So we should
start our journey of learning from identifier
Identifier
Smallest identifying unit in the program is known as identifier. In English you call it a word. In
programming language it is known as identifier. Identifiers can be categorized as constants,
variables, keywords, macros, functions, etc.
As of now we are only going to see constant, variable and keywords. Rest of the identifiers will be
covered in later chapters.
Constant
Any information is constant. Every program you make is to process data. For example, program to
add two numbers or calculate simple interest, etc. You need some data to process. In addition of
two numbers program, you need two numbers to perform task. Similarly, in simple interest program
you need principle, time and rate of interest information, and then only you can process it. In a nut
shell, this data is called constant.
Data=Information=Constant
Information or constant can be classified which gives us ease of handling data in our program.
Number is a constant, your name is also constant but you cannot perform multiplication between
#2 Identifiers in C Language
C Notes Vol-1 by Saurabh Shukla
www.mysirg.com
two names. So data can be categorized on the basis of kind of operations we can perform on it and
on internal binary representation.
Primary constants
Secondary constants
Integer
Real
Character
Array
String
Pointers
Structure
Union
Enumerator
#2 Identifiers in C Language
C Notes Vol-1 by Saurabh Shukla
www.mysirg.com
Variables
When you run any program, it consumes memory in RAM till its execution in process. To perform a
task program can use this memory for various reasons. One of the important reasons is to store
needful data, which is going to be used in processing. In addition of two numbers program, program
needs to preserve two data until addition task is over. You need to reserve memory blocks to store
these data, and these memory blocks should be named for future reference in the program.
It depends on the program, how many memory blocks are required to handle data. In addition of
two numbers, three memory spaces should be reserved, two blocks for two numbers that to be
added and third block is to store result.
These memory blocks are variables. They have names for identification.
Variable name is any combination of alphabet, digit and underscore. No other symbol is permitted.
#2 Identifiers in C Language
C Notes Vol-1 by Saurabh Shukla
www.mysirg.com
Keywords
Keywords are predefined words; their meaning is already known to compiler. Every word you are
using in the program must have known to compiler. If the meaning is not known to compiler then it
will yield an error. To avoid error, you have to declare such words to compiler by declaration
statements. Keywords are the words, whose meaning is already defined; you can directly use them
for specific reason.
There are 32 keywords according to the ANSI standard, but sometimes compiler may support
additional keywords too.
Remember
References
Exercise
1. In which category following data falls (Integer, Character, Real, String, Array, Structure, etc)
a. Mobile number
b. Name of a city
c. Rate of interest
d. Number of family members
e. Percentage
f. Your name
g. Password
h. Email id
i. Grade
2. Tick the correct variable name
a. A1
b. X-2
c. abc@12
d. 2f
e. M_23_a
f. Aa
g. W$
h. Emp id
i. FLOAT
j. float