0% found this document useful (0 votes)
7 views8 pages

Ppa F Part-1

The document discusses the concept of functions in programming, emphasizing their importance for modularity and reusability. It explains function declaration, calling, return types, and the distinction between library functions and user-defined functions. Additionally, it outlines the structure of functions with and without parameters, as well as their return values.

Uploaded by

tanishatyagi081
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views8 pages

Ppa F Part-1

The document discusses the concept of functions in programming, emphasizing their importance for modularity and reusability. It explains function declaration, calling, return types, and the distinction between library functions and user-defined functions. Additionally, it outlines the structure of functions with and without parameters, as well as their return values.

Uploaded by

tanishatyagi081
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Date.

Page
Ut uncto

Euncthng_a cYhamni4
l n w e an
olivde a larje pq0m in t the baic buldirg
blocks Knoton_ai funlhion. TRe funchon
Contains the set proIam2i tnkmenE
enclosed A functöón lan keGled
|multtple iasto povide seusabYy 44
modulaiy_to dhe Cjram:-
L aothex uords, wE Can ay that Hi
Colleptron of unchons eates aPgan
The unchsn ialto Khon as p10cedure
o Subtutein_in othec Pezrammnirg languag
Advantogs af hunchonB_Ja Capammi

b y un functrons, we Can avoid ewY1Hr


ameLoac/Cod again Aagan na Pea

an al C unckb any_Aumberd imes


in a prJan om anyplace iaa pog1an
() e Can haCK a large Cfrogam amy
tKen it diided inte_mutpk funchòns:

Reusability is Amain afCfa


aCKaemet_of

Howerer, fnchn Calliry alweys ahtad


IA a _ C pmzcm:
Date.

Page

Function A2pECHA TKYee_apecta s C uncto1


DFunction_dec larottoni A unction must bo
dlet lareel qlo be ina CP0grum
o tell Complep about he function fame
Junctrbn 2YumeCrA R retum tpe
2)FunCttan CalL =uhin Can be Called_on
any hert_jn Ke_preq sam. 7Ke
ameter lst mLt_not dtlen intunctron
Callrg function_declaraton. ueMust Pa
he dame number o zunctions est a It 2
pleclared_in he Zuncten oleclaratton.

s3Enction deineitton st Coniainathe actual


Btrents wkich am to be
executed: 9t_8 the moptiportant aspect
t o i c k He ontanl Come ken the-
zunctton Clled. HeG, u_must notice
that_dnLy one lealue Can he returnCd em
Hhe untho.
NoC-Fuactio asperts oJnda
1 Funthbn_oleelarattonrekn-tpe unctian namc
Cargumeat uat)i-
unctnname (4umetLiat
Euncthn Call
CttonclefihitisnTetum_te fuCAHóN Dunme
Cn Larzmot lijrt)
2 runthon bay: 33
Date

Page

TKe antex of CYeatrq tnchèn in


L Lañauagagikn belo
Yeicn-type_ Junchonnameldata tpe hxamctr
L Cocle to be Ex ECuke

pes e unctionzi Kert are too


ype unctòns_in C
crcmmig
DLbrar Funcdtbnp LibuyFuncttons art
leclard in he C headerr
hls suck as SCang); BintC),gt),-
Pts(),Jetchi) ee
Uaer -deiineol fincthosi- Kese kihdl e
unctthng twkich Qe Ctatkd
by he Cprogrcqmmer,_ o het he/she
Can w It may ttmes J Yeduceh
Compkxi of abeg_program 4Ophinize
h lodu

Keturn Value ACAunctron_m@ or me na


yeturna vale nm the Juncti%nIf
plo net haue_ to yeturn anj Vale vm
Hefunthbn, we Vold Jrt Tefurnt T
Date
Page Oa

CLibar dunctonsi- Lbrary functhons are


he ia built 4un Cton in C_
hat art paPEd and pkareo ak a Comman
place Called the Lhray Such
Junctions cure
wmd to Pcfamed some speafic_opexatton
eprintf s a Libray function uLd o'pit
onthe Consa
he Lbrary AunctrbNB art Creatta by
te designeyz q ConpilhrA. A CAtandlat
Lbrufuctns_ar deined inside the
pertt header 4ls aved voih the
extenyon h we need to_jnclude theu
header Hl jn_0ur progsan tomahe uE 4
the lihrny fls in our pngxori 4 nmake_wse
of ke bran uncHbns dehed in duch
headerA

ge L r defined functroni-_
Funchonn with no aumets d no yeturn Velu
Functhha Loith lo arauENtB a return Valu
3 Funttion_wih agumatp 4 no retuÝn va.
FunHon LAh umet 4 wih YetyrmValte.

Function wih_No rzumertp fno Return Valu


_
uch Aunctionp Can either he ued

qlebal Variables
Date
Page o

inclmde Stelioh)
t tinclude klonoh

Void gtatNum uctiin declartton


Voll maln)

CatNum funckhon Cal

Vo gratAkuml) functin_olefiniton
intiji
Print Entr 2 Neymber hut ypu Lnn te mfar

Pxintt A qptater number is Zd i)

el
Print Ke gcakr number t Yel",j)
3
3
Date

Pageo
Function HA no arqumEnZ Cud a eturn valne

#icluce (lonse h>


iat preatNeum ) Z/unehton_declaratin

Void maln)
Int xebult

Irt gratNum) Zunctdn_defihion

Int j qotakecNum
intH Enter 2 umhers hat ou iIant to
Compoie
Slang("dLd 4i,4j)i
I7 2
EaterNum =
3

rCoter Num =jS


Yetirn JCot rkum
Date

Page 03-

(3Function with argemetg 4no xeturn \alus


tnckude {Stodi
tinclud kCono h
Vold gretNum (int a, int b)1LZunctron
Declaafton
Volol meuA)
jat ljj
mntiLEntr 2 huimber to Camar

cleaiaitte4

PintL" Re grtate number iA =7d}


3
else
PntLAZJtatty ambey Ik Zel J-
3
Date

Page o
ulunthn Olfh arquat { a eturn Volue'=
include (Stelio:
int reetNum (nt a, iat b Hnctia_dechat
vold main()_

Pyiatt Gattr numbe rB to Cemur


LanfZdJd ai,4j)
PyintHL TKe eattr Neumber i5 2d, vekut)
3
i t grtatNum Cikt a, iat y) Aekaan cksitk

Yetur

elye
etunj -

You might also like