0% found this document useful (0 votes)
2 views12 pages

Understanding Switch Statements & Functions

The document discusses the switch statement and functions in programming, explaining how code execution starts from the main function and how functions like 'sum' are called and executed. It emphasizes the importance of function declaration and suggests using 'void' for non-mathematical tasks. Additionally, it provides a link to a related video for further reference.

Uploaded by

Divyank Rapria
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)
2 views12 pages

Understanding Switch Statements & Functions

The document discusses the switch statement and functions in programming, explaining how code execution starts from the main function and how functions like 'sum' are called and executed. It emphasizes the importance of function declaration and suggests using 'void' for non-mathematical tasks. Additionally, it provides a link to a related video for further reference.

Uploaded by

Divyank Rapria
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

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

You might also like