Gring
orwnacteu Jouirated coith
Sring is a Seuence ie Stoued ad on
nul? chaacter 'lo. the Shing
agu Chaactey.
arvay drleg
cen Rhing fcaracder enclßad
Sbing Constant
Condontiofeguexe
qute', 34 i3 Called Jiteal.
doualb te Baing
She daide auatel ane nota foort
"TajMaha"
t"2346
Whoneven a Sbing Contant i Cooriten anyehere
in a
a onggam. i? Stouted Someuhete in
e chaucter teminated oy
memoly a auay
a null chondtlen C'/o) . he Sbing Contant iRey
hecame afoinhen to e lint chaNaCHer in the
Qry. Foun exonpe tthe gtoing a Matal coil!
be sloned in memauir al
TIG
Jovo lol Joo2 oc3 Joo4 los5 loo6 loo7
Ma h a
loo8 loo
J\o
Each canocken occuliel one rte amd Compilen
Cutemoicay insorte the nll coracter ot te d.
fointen to e Chanacter TSo csente a g
ohe
mahal';
Delaing an Shing in Ci9 al limplb al declang
a one-dinerfonal aray
Chan Soinynom[8izei)
Arene ane to ceclane aSing in C
3. Bu cha
&. By ing literal
[Link] a Soing dten cothoued Siee
Chan&tJ: "Hellb wor"
[Link] a
Meale con be
alkweyf uccount forone
Charo cHen - we cont de Stoue a Bbing sf &zen
Hhen toe Sals alany declare a Gbioy co ze
Cqpal so ouI grarlenan nt).
StorI: "Hello, Jen!";
Chan
5. lssignoing Chanacfer dy ctanacte Sze
auign stoing eharacter by chaoder
Je Con alio stemembey oJette end chanactr
But cweSould
al 1o'lic i& a null chaacern
Chaacter by cChaucer coittol re.
?.ssiging dije
ch fau cey coithat
Chanocter c t heo end .he
We Con align chanacter
Coitt he NLL chaacter Compler
gie
oubmokeg
he 8ting &dekmined efy the
I1 Read Sraing aom lei
tinchde <skdioh>
int mainc)
Olan StrLso) deckane Shing
aiodfC"Snden shing );
chareter in a tolgy ue we
% oceet fecic shert onorn O,jut
inC
Chas Sbrinde
It moin C)
st[]- "Helo coan;
Chan
Chascer- ci',Shri1);
crifC'Sezod
Sbfy='w;chany ehe characer at hdx
Chanocfer = e
elondMedifiedStoring [Link]!
cloob ontl ea ch he nall
Coe Con we fon
tesminato
ntmoinc)
Char ftoJ=Hello,cwot! )
Jarlinti=ojtr!:o;i+)
Metole oet imnutale
t*inchudesldio-h>
int main c)
Chas Hello:)
Cha ao] "Hello":
perintfC*/sin", );
onindfC"evn',);
3
OHput
Hello
Hello
felb
Mutable:- meansf dhe Vale o he Vanobk con bo
Changed gten it i ckolbd.
Anmulabl; _meng the alue o he yanioblo came be
Changd lenit ie Beclartd.
J-D avay feorask
Jo c parogoaning Sbrg ga
an aUy
chaot [Link] fhy dmnnoted
oh a llcharacten C1o).
'e,'ea o'3,
nsgoonm te anint he Shing he to- dìrentlonal
chanacten aruy
+includexsddio->
# dne N5
O
# dçine LEN
int majn C)
[LENT "Oite', ned n,
Chan an[NI
indi;
Jon=o;i<N; i)
Sbing = Jhite 1010
Shing 4
= 020
klue
Coe Can fl sbig fo fnchrt in too coyf
-B hatng on auoy ldhaacen (ie grisg)
chouce
in he ig
+inchdexBddioR
Vold fint sbiagCchan Shrt)
P nd rmain c)
Chan mellage [J= "Hello,Loall!"
enekn
Output
Hello,cod
fauting a boihen to the_Yit chanacten
+ inctde<sldioh
Void faint_Sbiag Cchan +ftr
bintC"/s\n",St))
int moinc)
Chal meuogè C]="Hello, Weld!";
ferint shing Cneuge)
3
Hello,wanls
Shing unshers
Con
ane
wed u Vanioui abenoi and moniplabtine
On Shing. re foorctotypel fout thele oncting
Qre Bhouud in headen Alo <gting-h
ibany unclinl wed beo
Hhene ae Revenal clibilo4
mani alaste Shring&
Shlenc)
orefunt he bygththe
is urctinnumber gfcthe Shing
i.e. the chanacten in &tring
excding the teminohng nall characle.
tinchde<stdioR>
int main c)
Chas shr}
int longt;
toindyC"Enen the
ScnfC"8,St);
sting =n;
lergth stbnCst,
Endente oing =
doagth he Snga =
OShompC)
gbing .the tuo shing match, SombC)
Uetun Value o,oherwiRe itetun o non
Tero value. his unction Comparer the
Stiag Chanacten by chanacten he CompaniBon
I& ea chd
Stspi kon eiten -he end s shigg
bu the Couveubondirg Chanacter in tuoo
Sting are not Some
Porgom to undosland he cuonk brcnpC)Jadon
+include <stdio-A
+inclde<Sting k
int moinC)
Chan Str Jo], Sts 2Lio];
printC Enten-re forgt ghring );
ScarfC"g", Stht);
clunintf'Ehen the fcorel ring =);
BoorfC s, Sr2);
YCcstcnp(Shi,Sr)) ==o)
poinycStigg ane fome in );
ehe
fainfc"Sbigf ane not fomg \n
Sr2); C&trt Strcot
shr);
Sonyl"3',
=); brng fot he
C'Enten hrin
moinC) int
sHiok #inclade
". becinel gieg furt functin
e
thigtainy ten hon"ze" Bhng
8 Setord
ond "King" Stingi fust 3olng. too
S4>S2 chon >o
==f2 CehonS =0
SL<S2 cshen <0
uetunna
Value 82) (e, Shrcmb
Sca (shd,"ou");
Shcry) wed caoyiag one Shring
foctiom if
hg anohei, we (an ue shehyc) gnodm.
to
[20] "Helo wonld!
Chor Str!
Chan Str2 [2o])*
fringCs, st);
Output’ Hellocanll