Level 1. Introduction to C 1.3. Functions I receive Inputs, You receive Output What is a function? Roughly speaking, in the mathematical sense, it is a mapping from some input space to some output space such that no two different output values correspond to the same input value. In programming, we also call inputs the arguments given to a function. In fact, we even make a slight distinction between the arguments and the parameters of the functions. We call variable inputs, used in the output expression of the function, the arguments, and exact valued inputs, used in the final computation of the function's output, the arguments. Let's now recall a simple mathematical function as an example: $$ f(x) = x + 1 $$ A computation function (i.e., a function in programming) is not too much different than a mathematical one. It has all the components that the mathematical one has: A name (it is named f in our example) Parameters or input variables (it is just a single paramet...
Comments
Post a Comment