The contents of this chapter include all of the following: Summarize, at a top level, the key functions of an operating system (OS); discuss the evolution of operating systems for early simple batch systems to modern complex systems; discuss the key design areas that have been instrumental in the development of modern operating systems. | CSC103: Introduction to Computer and Programming Lecture No 14 Previous lecture Introduction to structure programming Function definition Function call Function prototype Today’s lecture outline Menu driven program using functions Function call by value Scope of variable Local Global Menu driven program using functions Menu is Factorial of a number Prime number Even or odd Exit Write a program Passing Values between Functions The mechanism used to convey information to the function is the ‘argument’ or ‘parameter’ You have already used the arguments in the printf( ) and scanf( ) function the format string and the list of variables used inside the parentheses in these functions are arguments Example program a b c sum x y z d Program Output Enter any three number: 5 6 2 Sum = 13 Press any key to continue . . . 5 6 2 6 5 2 13 Sum = 13 13 Go to program Points to remember The variables a, b and c are called ‘actual arguments’, whereas the variables x, y and z are called ‘formal arguments’ Any number of arguments can be passed to a function being called. However, the type, order and number of the actual and formal arguments must always be same The return statement serves two purposes On executing the return statement it immediately transfers the control back to the calling program It returns the value present in the parentheses after return, to th3e calling program Cont. There is no restriction on the number of return statements that may be present in a function. The return value should be accepted in the calling function If called function should not return any value, the it must be mentioned by using the keyword void A function can return only one value at a time. Thus, the following statements are invalid. Cont. If the value of a formal argument is changed in the called function, the corresponding change does not take place in the calling function. For example 30 a 60 b Menu driven program using functions call by value Menu is Factorial of a number Prime number Even . | CSC103: Introduction to Computer and Programming Lecture No 14 Previous lecture Introduction to structure programming Function definition Function call Function prototype Today’s lecture outline Menu driven program using functions Function call by value Scope of variable Local Global Menu driven program using functions Menu is Factorial of a number Prime number Even or odd Exit Write a program Passing Values between Functions The mechanism used to convey information to the function is the ‘argument’ or ‘parameter’ You have already used the arguments in the printf( ) and scanf( ) function the format string and the list of variables used inside the parentheses in these functions are arguments Example program a b c sum x y z d Program Output Enter any three number: 5 6 2 Sum = 13 Press any key to continue . . . 5 6 2 6 5 2 13 Sum = 13 13 Go to program Points to remember The variables a, b and c are called ‘actual arguments’, whereas the variables x, y and z are called ‘formal arguments’