Functions in C

Almost all programming languages have some equivalent of the function. You may have met them under the alternative names subroutine or procedure. Some languages distinguish between functions which return variables and those which don’t. C assumes that every function will return a value. If the programmer wants a return value, this is achieved using the return statement. If no return…

Scope of Function Variables

Only a limited amount of information is available within each function. Variables declared within the calling function can’t be accessed unless they are passed to the called function as arguments. The only other contact a function might have with the outside world is through global variables. Local variables are declared within a function. They are created anew each time the…

Pointers in C

Pointers are not exclusive to functions, but this seems a good place to introduce the pointer type. Imagine that we have an int called i. Its address could be represented by the symbol &i. If the pointer is to be stored as a variable, it should be stored like this. int *pi = &i; which is the same as int…