Showing posts with label beginner. Show all posts
Showing posts with label beginner. Show all posts

Friday, 29 April 2011

14 · Functions implementations

2 Functions are prototyped, defined and called: print_always_7() which is a function used for its side-effects and sum() which is a pure function(used for the return value)

Saturday, 9 April 2011

Functions in pseudo-code

We create function prototypes, definitions, and calls, all in pseudo-code. In this way we understand the basic skeleton of single filed C source code. Parameters(for prototypes and definitions) and arguments(for calls) are succinctly explained. The idea of return types(or the lack thereof, using void) is examined, and the reason why functions exist in code is also explained.

Line by line explanation

In this succinct tutorial, we review what has been taught before, but go little-by-little, through each line explaining in more detail the program that we have been creating.

If statement

The if statement serves for bifurcating the execution of the instructions within the program.
if the condition of the if statement results in a boolean true(non-zero), the if code block executes, otherwise(boolean false, AKA zero) it does not.

We build and run the program several times, in each occasion modifying the resulting if conditional expression, so as to check how the program behaves with different conditions.