chavaeterg eminated
A 18
Sequen ce
wth a null chax geter\D
stre shng loubo is nasded
HE) End strng
ehar eh
Char sth 3
eharaeei
H is a H 1s á
strng
Char sth CJ oempty strüg
char stt io)"HELLD;
End
str ing
yScant
2) qets CO
getcha (), getch( ) ,gthe (
3)
Sean (y.s",sir);
Soan omin ate as 4 ibds a blank space
Hello wold. tthe ghr wil Cor aun ony
gets ( sh);
gts) takes he startiy oddiess
ermio aes uoth a ndl harader
gekcha() reado unt! der mnatis
oguence ,
ehar is ertered (\)
got6()1Syoto -chah qals (chan *_)
pudsl)- int puts (eonst che * shig)
hara cer
(); get
h gtch ar
( chl= )
ushile &tore ehar
str J ch; ehar
I get all
\o; erminale uith null
Nidhg srings
ptutb ( ' s , s t )
9pstint b ()
2) put s () puts (B),.
) puthr ()
2 putchay.( str J))
tomten Jo a momory Ted rather han direty o a standad
harn directly
il
sprut ( buf, num ). d, hum)
Zupaesoiny e
san, ('-Loeioo, sn)
This scant uotll stop ucceptig a eharaorex
haiade onee
0r a ehor that i_
hot a yowel is entered.
scan, ( 1. L^ aelol st)
"This wil not acce the ehar in LJ, aecepis vher har
3Sans shr, )d,&num,
cceprs hrçg, enveto tothe dota speajer. Spedyed
(here '.d ) num
Reads and
prustt ('the shrig is : pd nly uppe
We ean gtbre either
in Natable Qangth ormal
Variable Jengh
Aangh Darnited
Controlled
Rxed langth
be stored
to small, al elemets connot
is Jarge, mem ory usill be asted.
Vaiable length be' expanded o Conttacted
Sangth
omabdab the lement in n
) Jarngth ContnMledShring haacter_
the numbe
speity the
* You aood to [peity
in he STg
erded th a delunter, ohich ive
the end
eg) Comma, 5emieolon coon,dash
Char st io
he ana
Port
Shriag
Doerakions on
Aansgh a slring is hne
charaete n the
Vo h
blank Spaces
Jangth ("\o'o longth
main ()
slepl
Paunt ("Enter he sirihg): shep 2 Tepedt whda Soop
:
gets (shr);
while( st ( J )
Jenghi
step 5 . End.
Sangtn
Enier he stHg Hello
steurnD Jength is 5
3
R) eonyeri e h a x a
A -2
subtrat 32.
eonyert a
r main ()
sepl
char str Lio6],0pper cane &t (o0; stsh - Null
Step 2: while
prunsnter the srng;
sd uppercase si J sl)
-32
gets (str); else
else
pruny"(Me Uppercabe strÛg is )
putsuprerea Se gtr)
strhg into Jouercase
3) Conert
else
3
prunth, ('the }nsercg se srng
puls Wey cases);
3
Unto new
Goncatenate Two shriügs
) are0 sAringy. hen
hen oncotenaon
2, s and 32
hos sI ollswed by 52
pstoduees a sBrig wüh
Lab pgm.
a string tb anshey
) Appending s2 - deGtinatbn
appandng
geb (Sestsir);
\o)
Ushle ( seststr iJ)
utle( Ai, Ho are ybu
Desistr ) o ;
psrutl, ("Ajer append ig
puts( Destsi)
3
Compare Auo
Sremp (sh, str 2);
i4(io)
prutb('strng
elge
cqual"),
prtun"hings
shùg (
oifh the lagt, char
har
S0 n
an
oth nd \asl h
In maun
Int
Enter the sring)
prunty ("
gots (str);
-13
J= shlen (str)
whe ( i 4j)
temp str iJ;
3
psunth ho reVer Se strg ts )
put s ( s t ;
3
8) Eairadug #ubstring
the eotems ° the
bohere n i_
he numbe T harader_ be exracted
0orld
Hello
1t sl
Hello W
S,T >
o man (
(nt i =0 n
gets (st) Hello
n i5 2.
seanh ( ""/d &n);
subsh iJ sty [i3;
3
is;
prnth(" The substring
pts( Subsi ;
3
i9 om Right R) Exhactig yom midale
io man ( ) iv) \nsertng shng
dnther
gets ( st);
j- strlen ( sty-n' ) \ndexy
whle ( st eiJ 1 ) shvng
vi) Replace patlen wh
an other polern ú a
Miscallanosuc BArÝg ond Chaxacer tunchions
ChavgeBer Maripuloßn funeliuns.
Functiong Exampe
whelhe ehar e
isalnum (1nt ) checks
is aphanumer' c
(salpha ('h)
isapha ().
|senhl (int ) is e a
conol characke senthl (;
1sdigit ( int ) har is a dagt chanater
goaphse
hexadeuma)
toupper (ut )
har strca (har stlcon'st ha *stT 2);)"
har gtriL5] Pangramm
har s2to]
she (str,str2)
pant stl is ls
is .s,s);
shl to st 2
Coptes to t s2.
shl shoud be blg anong
strncat functon
Si2e
har
slncal (chay A stt), onst
ehar
Chay strt S56) =" Pasgiam; Piogtam In
Stincat(S , ót , 2) 3
pun s ls .&, stl)
shch unction
|har char
he
strchr - searhes fist
eharactey e the Striüg.
n is tound in
Lab
har shrch Const char
yom backuson ds
\nt sr mp char sltl, cnst chaa s\r 2);
returns identie)
slncmp s\2, Si2e n):
char
\(nt srnemp Cha
shi and slt
2
Comparea bytes %
Shh: HELLD
char x 8r2
shncmp ( char glv,
g\rl,
ideniic!
slhings
Srepy strl, har *sr 2),
cha char
Copies sha to s )
Siib] HEL;
has st| fio]
AELLO
sirepy ( stl,s2);
pan.s,str)
shnepy
n);)
har stncpy ( cha xshr1, Char sh2, 512e
Copies n har
har rom sv2 to
strnep (st, shre, 2)
Sden
gjves the Jength he
shlen (st);
Shsr
Chor sthi] = HAPPy BiRTH DAY
grsts ( shl,sr 2);
o/P s 2 in sh)
shespn (stsl,st2
ole
aogTanming
in
sh):
st2 - n
sty) hah moche
Roturns he ndex is) char
any ehan in sl 2
shspn
(sh, sly 2) ;
s 6pn
BIRI)DAY
Ppy BIRIH DAY;
doesnel nnat hes
(bden bat
ixst
any har n sr 2, thos
Sunstion returns to a porter
Hello
dahmile
to, has world;
stlJHelo,
Chat usexld
strte)
Coverdo Skúg
doole
otoi
d o ( 12.39 is the nsWer );
ool
X- \23A5)
Sivng- aTray (group) horacheif
ehar name I
20 stude s
eha names i 20)20)
a raes fbJi6y= 5"Ram "Mohan', shyam,Hari
Na So) Ramn
Names S3 MO
Pnters
All dotas and programa neod Js be placed in
he RAM is a a part pr m
Stack - A Aixed 522
and
|led botom to toe
Heap - blch
Calb mamory
Whn a Vam cble ió
-
enory is olloeed
dec larod
tondomiy blotk
a
speaje
Vamable
nt
int 2 byjes is aldsted
x Pounteg varñable that holds he mornory
Ibcalion canhe VaDabk
seá
nyormabwi betwaan union
’ pass
pass arras and shrhgs untòn ogum
Cyoate dato struetures ike ress, in hed ust quue
memory allocabso a Vai able .
ynamie
peclarÜg poinlers
dataty pe
Int num ; qloat chor ch;
X
addhess
pruni".d,
(nt x =10
int xptr.y 1006
nude 51dioh> 3tartüg aadress
man() pt
nt
Int
ptr
ptr)
paun ( d , ptr);
Bth p onter and Vomabl
Float * ptr Should have
dotoype
program psut Helloworld , ushg pote
heude < sBdo.h
ind moaun ()
ch = "Hello Woild: le Hello World
char
prunt .s",h
teturn0
Add tuwo oaing poink numbers, esut shoudd
contan ony tuo digt_ aler decimal
int main()
Flbot num)num2, Sum pnumi= & um),pum
2num2y
prutl (Fntar the 0o humber 6);
psum
Seanb(
prutb' bum is 2 *psum);
etun
Eter nomberS
25 3 )
Sum
Avea
inde < sth>
int ma ()
double radius, area
double pradius
radius",
prtuth (' Ente the
dcan ." , pradius);
Mpareo (^pradi uç) (* pradius);
punih Area parea)
Pm to test tVe, -Ve oY = D,
int main l
int num, pum = &mum;
print, (" ner any nurmber);
sean ('.d, pnum),
pum 0)
punbhe No is -ve);
else
pu "The No is =0 ):
3
Poislers
) Null Pointe
* dos not pont yaue
valid addres,
donded by NuL
heoders les
Geneic Poters
hondling
This boirhe has Void a
xVoid ptr ;
Void
ph
Phr ch;
&
3
Pasaing agumenhs to uned ino using poterá
) Delare the unctn para meter ponters
2) Use the dere\erened ponters (*)
pass Ahe address
he Velae y Ahe ealling quncion to
( eall by relerenee )
#nlude
int mon () )
\nt numi, numa,t a
put Enter 2 Nos);
Seanh( d . , &numl, &num 2)}
5Wm &num1, num 2, total)3
teturn 0
Noid sum( int *a, nt * b, nt *t)
3
biggost , 3 Ns
nude
hum) num 3, \arge
Prnt " Enter 3 Nos;
& numi, &num 2, &nma);
g1aten (& numl, e nwn 2
&num 3 ,
\arga;
lar
lax)
i
fotge poialeh
9gsag poindo
Chas * pln :atay - Name j
Sihuthte pointo
The poi nda poldi
Sthutt stsutaae *pt®
Funten polog.
it (*pt ) (nt, chan);
boub le potas
dutatype ** poto-Nlhuej
G
pst laeutl
Vold paiute
Vod per'd o-name
witd ponte
Congtat pi ao point the "maln menohy
data typey Cont pol Jeh_hamej
poit to constat
tons! doda- ype poldeo na me',
pold