Saturday, March 5, 2011

Functions in pseudo-code

Functions are code blocks that execute where the function call is placed in the code. That could be inside the main function, inside another function that is called inside main, inside another function that is called inside another function that is called inside main, and so on.

Function prototypes serve the builder to inform a priori what types(how much allocation must be made and how must it be divided) does the function return and receive(as parameters).

Function definitions serve to specify the code to be executed, when the function call is encountered in the code.

Span of statements

We check the behaviour of the builder(GCC from the MinGW project) in regards to line separations amidst statements. First it is separated at white-spaces between tokens(no problem), then amidst a string literal(compilation problem) and finally we divide the string literal into two string literals, which works.

Line by line explanation

We take time to scrutinize the code that we previously wrote, line by line, reviewing and understanding what each line prominently does.

If statement

The if clause is useful in that allows bifurcations : true and false tracks. If the if expression evaluates to non-zero(1, 20, -5, 0.3202), the true track is chosen by the computer's processor. If the if expression evaluates to zero(0), the false track is chosen.

Pseudo code is firstly used, then the actual C syntax replaces the pseudo code, and finally the application is built and run.

Comment usage

Comments are useful for education materials, that is documentation, manuals, tutorials, references, etc. becuase they allow in-code, to explain in further detail each successive line(or group of lines), in the syntax and general logic of the application.
Also, how a library works, how the program is supposed to be used or expanded from the user programmer's perspective, etc.

The two types of comments in C are:

/* C classic comment
May span multiple lines*/

// C++ derived comment, endures up until a newline is encountered(up until the end of the line)