Showing posts with label Code::Blocks. Show all posts
Showing posts with label Code::Blocks. Show all posts

Saturday, 9 April 2011

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.

Friday, 8 April 2011

First C program built (from terminal)

We prepare the directory tree so that we have a well sorted hierarchy. In that way we are better organized to build, whether we use the Code::Blocks IDE, or directly from the command line. Some batch commands (like tree /f ) are shown. We finally build code from the terminal so as to provide another way to build our programs. This is the Unix way of building a C source file.

Code::Blocks setup and test

We correct the options at the Code::Blocks building properties, we change the link tool place holder: instead of mingw-g++, we point to the executable mingw-gcc, which serves as a compiler, linker and preprocessor program. We test the project with which we previously had difficulty building, this time succeeding in showing no errors and outputting to the command prompt.

Code::Blocks setup

The Code::Blocks is set-up so that we can use the MinGW set of utilities for compilation. C/C++( .c , .h , .cpp , .cc , .C , .H , .CPP , .CC , etc.) file extensions are associated with Code::Blocks. The first C project is tried out using the Code::Blocks project templates. There's a bug in Code::Blocks that is fixed in later versions, but for this version I show you how to fix it in the next video in the series.