CCP Set 3
CCP Set 3
CCP Set 3
dleueloped in the
lang C was
npro9mmmunq-
atb Boll, la
ab boll, touos
boratou'o
labona
Ridchie
eauly 19 10's
Cay by dennis
Chaattuistia of C Langag
uch Set built-in ntion
C .s a obust Jan9
and opetalor and
th
Combines featwes assembly languag9e
high deuel Aang
suutt od for
shuctveno. programming
C i s well
Code can be oganized as a coiloclron
One or mae funcuons.
s a portable language
proqramnng.
Pau'mauly useo fer y om
se
Compilo, librantes iturpratin ae phin
npleretlod n c
Stuctwua a e proeram'
d i r e c t i ues
ppuepoe D C e s s o r
GLobal de c l a r a l i o n s
main t)
Jocal declaration
s
Statesents,
Funchon1 ( )
talermo4uty
Loyng deb
The peue proOssor diueciues cont ains ape caal
rbui cliono Ma indicate how o popaxe u
progsuam for compilalion
inoluodo <sAdio. h>
nt main)
The Oorld Qf
pxiul Cn twoltome. To
elnn O,
mainC)-&t
mainC) atiug point eor program eketubon
unelUsos.
be Two uccessi ue
Thoe Cannot6
cannot be useol a olenuo
dlentu
Keyooels the
ehara ctuu ab form
Cse
alphabet
The 1
sgnipeant, witu an alphabst
Jdlonth fes nan Nane musF bepin
The oleulioa
unde CONO møe that 3l characlee
3/ characiy
e an contain.
Juhoulol not
Name8
noElHLembu ml name
Vauicl J d e l f eu-
,
n a n . , #anpname , Co)
mae Kdaph-ro,
bas ie-Pa - HRA, aubo,
L e r 9 CLUbu
asic ata types in c
ta ype. eyoot 8 2e in Ran
us
ed
Byles
Characti char -
The range c h a
is qiun as-128 to 127.
Note to stoo chaxaTB not numbea, 20
Chan gupposed eharacTa
at mmoy
Lshy this seange Reason is
aseutored u g tnetr AScIl codes. lor . charachd A
In memo- A usill be doiaol ag bine
has A Scil coda 65
6s
Jong. int -17483648 to 147Y9 3647
doublu 3 4E-4932 to I. tE+ Y
932
Vauabte manunumamas euuon to ths da
Storogo loeation un cemp u l a m o l
UMen cusng vaajab o, acualy
Oata tg/pes ae Used to
assgned to a vasiabe .
nott the type ovalu
Focir basie dala types in e au
nb,
ollowg-
a
cha float aud olouba
enua Ryutar
Oatatype v Van 2 Van
Aatatybes Classtfrcaluon
Basie atalypts aereuod lalalybeg U3e delinod
untt aso Datotypay
eha
Ploatt peint enwm
doubtaL
Basic a l a typer
OThe vaseuabo o pe int
Vasuablas o s eha hold a singla. Ascii ehamckos
enclos ed oiin tiv0 &inglo quoiis and
orcapy l byla
hace momof ounge 128 +o+ l27 -
T hThe
e vasiableg o t p e float hold tho values awith
decimal onls and occepp fouu bytis memar spact
Range 3YE-38
loat X, age
loat p 3-1Y,
loat oge S,
hold
hold bytes
bytes % men
mem
double
7 6 209
Rdgc decebie. a
3.21Y5 26 ;
Exampe
C u 3u
e se
d d lo modnhy
lo modah
Modefre in knouon R
2ctakehrea
also
Modihos inc
ane
basic da ta. types
RIne d
uns1gnod
short
Gencaal Lyhax
KvataHe iit7;
basie datalype>
Kmodtihie 7
-
Exampe
= 3S
NOTE inE
oe Can
wnsigned noba aPpty ualehiko the float
b
i g e of deuba
-
we can i n ceeas
but
2uakife
usiTg Long ama ghsrt on
chaL
char /.c
Sgmed t h a
unsigned chon
tonyint 1
tunsigred long i r t Lu
Apublo. 8
lorg l e s a
LA8 o 127
ehan byte
0 to 256
imed
cha
byt
9168 fo 32767
tnt
1474836Y8 to 2147,483,647
-
Smbalie Constaut
kning symbeXte name.
A s s i g n m o n t oConsta
nts t o a
nama at
values aste asIgned to these
Conit amt
praýran.
he b eginning e t h
Syntax
#dopin 4ymbelie-name Value-ocenstant
tdehine MAX 00
#olepru. PI 14159
Callla
8e
8 erm
m ae
t it
m e sy
m 3
ase
mamee
ymbolic
tonstant ddenthiong eon t Pda
}do
blamb space belT
belT.eon
(a) no
Ruults-
Ruulls- Co)
(b) vse c a p l l o l t o l e
csLest
ehth&emi
Colon
LemicolN.
enos
n e i
C) be olnangd
)Valuu maynot
hertton i n t h rogrom.
progrom
complo duueeliu
duecliu
compilo
apeprocessor
olofine. As
Znvalud olopine X = .5
Idine N 25
define MAX t0
#Defne aRRAY 11
Edotine PRICE fvo
e clarin Censhamg
leng olake
ata Types Thec classea dala tpe
(a) Poumasy (er kondamontal) dataipes
(b) Oexiued data typas
(C) Use- doknod
data type
Inttge lypes
numberu tl a ang v a l u z
Inttgexs ase cohole
Suppostecd by a pasutcuela machir
Can e 3fored. dopenod
Size eo
The Size
The an intrger thal
n h e compulo
t a 2zo of the
cooMd Longths
I£ toe ue a l6 biE the suange - 32769
-82768 to
to
b sange
ittoo valtueis limitao
to declane viobles
exist'ng olatatype
iten fo t
ola toctyhs
tapedel int nils
bample tufpdey float make
wnits symboles int)
wnils batehl, baletu,
manc& namil5o, name 2C50],
The main. aduantage eg be
ype edey
dsh iis that we
coecat leaning ul, data tiypu narm fer dnowau
meaning[ul
e eeadiblluy othe prorem
Use-dened dataype enum
Enumealeo data trphe. i oleenool. a
enum
ddenlijier valie 1, value 2, .valuenf.
The
The identikex. is a
usee- dehned onumenalod data
cohuch Can b
ype usec o
Valuog
ole clare vtiablg Chat
can haue ome o e encloseol. lhin
braces CRuooU as enemeralion Constanß)
TUsda
cocek-evud = 9aturodayy
TheCompiloL alomaliealuy ass1ons
6el beginning w t o a l l ntegen digi
Bu enuneralion
Censtanu
Assig
Assigning values to Vauialbles t
ValuOS can be assrgned. to vou abta eusIM
t
vasuables Cclle
unettal-valua = ° j
Eramppl
Hea yo +
nal valeu =
Int
MAX
y EZ
=
x
sdertepe
CenholL chassaste like n lb, \m |a eto
can also e
icludeel
Exampu
to the LoOrld. oe languag")
print, C oelcCome
"
(a)
puinth Cn Rerat 7AJe /f", 13, 'a', 8);
(b)
Result: llal.8
ce) puicth Cn Reucutt : 7.d Je 7f, 12,' a, A:8);
Res ult: 2 o . 8
pavinatC"C"hl2Reuutt:2.83d\t %e\E 7f°, ,'a 3);
Result a
Rescult a 2YS37
pn C"n Yosetet: 5d |t x \E ZtHz", 231, 221,2 34);
Rescelt 234 EA OxEA
g , ag,g3, 9
Scanf (" conitiol &bung
3pecifog thO e a n d
forrnat
ceibel g6ting
has fo be obtained hm tt
ThThe
e
t hthe data that localion
tn monn
keyboardd and Bfored in
agumon
tg
the
poend by blank
blank spac
paca,
any
fundion igno Uzen
The The gca
Scan
newlns
enloned by
Jabs and
localLONS use nasd
we nood
values memo
- To store
addnes*
of thu variable is donoted by an
Th addiee
oeloood by thu name o t h vuabo
g
Examply Oimt num
QcanfC 7. d', knum);
l o a t salay;
Scanf C' ", salary);
(3) char ohj
Scant C" %e", Ach);
( 8 chal cbollo7;
Aean %s", s0)
- Scan Temunoliy aS 8ovN as i t eucouty
enanaclo
utnule
spae s
havacle Set - The charactinsin c axe gt0uped nto
ollorg Catogasues
(a) kettus Cc) &pecial chaua clixs
cb) Ogct (a) Lohiti sþaces
Aettos Uppocase. A . Z
Lowolcase, a z
ugcts edee decemal dipit 0... 9
SpeaalChaxaclis, Cpiod); :? T|Cbackslazh)
-Cunduscore) ? 7 2 Campexsa nda)
caet) * (asliisk -
(munus)+< Copnig
angle baackut er lesa thar)> Cclosing
angle braakot er
greal tan)
Clelt parenthosi Let brace
) igbt parentheis ught braa
numbu &'gn
Lohibt sbace blank space, horu zontal tob neuo ine .
C tokens
3 2 - b i machihes
2
ma
means by to-
mullby
manassa e exponant
Genval ferm
notalien s eallad loaling point torm
This 8-1863 -h2E-1
e- Set5
E x - 0 .6SeY
7SO000Oo00 7SE8 7.SE9
-
g-686 -
-
0.
OOooO0 B68
valui
valuLL Cuouon a s A s c I £
7hu hau intege
output 97)
pxintf C"%o" , 'a') output a)
pinTy C"%e', 97) ;
2 b i n g lenatants -
Vaniabl
Nataupo CAupporks thkee elasses data p
aimay fandamental dal pe
Tntigel (imt, short iut, Long imt
Soi vool dala ype
unsigrad nt
Ose doh'neel unsinad eont int
data pA unwgneok Long n
Chala c t ehal
8gn eo char
wtkignoad cla
Plootling point loat
odouble
Vordl Lerng odeub