Name..Haris Malik
Name..Haris Malik
HARIS MALIK
ROLL.NO..122
FIST SAMISTER
ADDRES.CHATO CHOK
MARDAN
MOBILE NO 03070991997
C/C/++
Introduction
Writing a computer program is like building a house.
To do a good job, certain fundamental construction
materials are required and one must know how to use
these materials.
In the same way, C program is constructed from C
statements or instructions.
C statements can be constructed from numbers,
expressions, reserved words, and user-defined words.
C/C++ Character Set
C character set consists of Numeric characters,
Alphabetic characters, Special characters, and white
space characters.
Numeric Character Set: Numeric characters are
0,1,2,3,4,5,6,7,8 and 9.
Alphabetic Character Set: Alphabetic characters are
upper and lower-case letter of the English language
(A,B,C,…..Z, a,b,c,….z)
Special Characters Set
The special character are period (.), Comma(,),
Semicolon (;), Colon(:), Single and Double quotes (‘
& “), plus and minus sign (+ -), Asterisk (*), Slash
(/), Back slash(\), Equal sign (=), Parenthesis ( ),
Percent sign (%), less and greater signs (< >), Hash
or number sign (#), Ampersand (&), Question Mark
(?), opening and closing braces ({}) and a blank
character which is equivalent to a space on keyboard.
White Space Characters
Any character that produces blank space when
printed is called a white space character.
The white space characters are spces, tabs, new lines
and comments.
These are used to make your programs more readable
and easier to maintain.
For example, the statement z=x+y can be written as:
z=x+y
C/C++ Reserved Words
Reserved words or keywords are those words that are
reserved for specific purpose and cannot be used for
other purposes.
They have special meanings and compiler knows
their meanings.
In C/C++ all keywords are in lower-case.
Since upper case and lower-case characters are not
equivalent in C/C++, therefore the keywords must be
entered in lower-case and must be spelled correctly.
Contd…
Reserved words cannot be used as user-defined
names.
Some of the most frequently used C reserved words
are given below:
Break default for regular while
Case do goto return struct
Char double if short switch
Else int singed float
User-Defined Words
Words that are not reserved are called User-defined
words or programmer-supplied names, because the
programmer makes them.
Such words are also known as data names or
identifiers.
Data names are most common type of user-defined
words.
Data is stored in such positions that it can be referred
to by name.
Contd…
The word identifier is used as a general terminology
for names given to variables, constants, arrays,
functions, file-names etc.
Thus data-names are only one from of identifiers.
Rules for Identifiers
1. Legal characters of user-defined names include
letters (A to Z or a to z), digits (0 to 9) and only
special character underscore ( _ ).
2. Identifiers must be unique in a program, just as the
Roll-numbers of the students are in a class are
unique.
3. Both upper and lower-case letters are allowed in a
C/C++ program. But since C/C++ is a case-sensitive
language, therefore it distinguishes between
uppercase and lowercase letters.
Contd…
For example TAX, Tax, TaX or tax are four different
identifiers.
Similarly, RNO is different from Rno which is
3. Increment & Decrement operators ++ and - - are increment & decrement optrs.