Assignment 4
Assignment 4
Page
Msigmed4
6tYCy ) function
Jtxplain srlen C) and
Nith example
a function in Cprogyo.
TH
Stylen): It j5 U6d To fiha
mmina language that 5
lof a otring It retuns.
the (Ûngth
nUmber lof chaYactevs
noll chavactex(\o
uding the include
# <6tdio: h
atring hz
chay ch 20|= h string: d d
pxint of th 0:
CLeogthretorn
5tvlen (co
char ch (20]=ho10
char che (20
5trcpy (Ch2 ch
print INalu of 6eCond strina.:/5"chK
stuxn0
2\Explain Vser defined function Nith example
An' dentifiey 15 a u5eY -defined name of
an etity to deotify t uniducly during the
pxogYam execution
RxoMnple:
gt max K6
char Gtudeat name Bo:
Here marks aod gtudet name are identi
fiers.
tem) arY C:
arr size -i-1ter
int main C)
CIASSMAte
Date
Page
print f (M
Yeverse Num coUmbex 5 51ze
print f ReverTd numbers
Por Gint ieo: i< 5ize itt)
prigt (n
The values of
8 The value of the acto- 3 paxameYS do
a paramcte rs do Agt by changing the Chanaes
foreoa
00YoneTe
change by changing Dararkerers
the fdrmdt povoeTe
formnal axa- Actual ond toxma ovo
HAual 00d at ments are cYeated
uments are created the 5ome mmory loc-
the diffxent meno vy ation oiy
Iocotio0:
majn
pxint f ("Eotey y
5can ( ddy)
5ub
mut
diy C
getch
Exolaio reCoYSion with exormple
RecuYiOn mean a functioo calls tself
xepetitiyely A_ YeCUYS0yC tontion cotain5
a fynction' callto it5¢f inside t5 body
Int N fa
cIrscy0:
pxint f (Enterlnmhexo:
5Can -f ( c N:
fact =4act oxidl N
pxint ( ofactoYiól 15 kd; for
4cth ()
int factokiol nt N
if (N =
e \se
CN* foctoral (NI)
AdNOCtagc5
-Reduces lenath of the pro aram
Redr ces y0deces5aYy calhot ofa fun
lctioootias