Switch Statement and Functions
16 February 2022 15:27
Lecture 8 Switch Statement and Functions
Page 1
Lecture 8 Switch Statement and Functions
Page 2
Lecture 8 Switch Statement and Functions
Page 3
Lecture 8 Switch Statement and Functions
Page 4
Lecture 8 Switch Statement and Functions
Page 5
what happens here is code always start from main function and then work like usual but when it sees
sum function then it try to find sum function in upper part and when it finds it then it assign value of num1
and num2 to a and b and perform tasks which is given to it and then return c as written and then replaces
whole sum function with c (because you said to return c)
if you want to write function later on not up as before then write int sum (int a , int b) which says computer
that sum is forward and not here and keep searching
REFER HERE : [Link]
Lecture 8 Switch Statement and Functions
Page 6
basically for non mathematical tasks use void
Lecture 8 Switch Statement and Functions
Page 7
Lecture 8 Switch Statement and Functions
Page 8
Lecture 8 Switch Statement and Functions
Page 9
Lecture 8 Switch Statement and Functions
Page 10
Lecture 8 Switch Statement and Functions
Page 11