Below you will find pages that utilize the taxonomy term “procedural programming”
September 18, 2013
Array in c
Arrays in any programming language is one of the “power tools” you can use to organize data of same type. On the positive side elements of an array can be accessed in constant time because of the maintained indexes. On the downside array is fixed size and taking space after each other in memory which is not to efficient.
Array declaration and accessing elements works as in other languages, with an example:
September 12, 2013
Structures in c – basics
Structures in c are used to represent data what have connections to each other in a single variable. This could be a record from a database.
Structures can be declared outside the functions to give access for all the function in the program. Other options for declaration is in the main header file(good idea), or inside main or other function which would make it available only for local use. A good practice is to not only declare the structure by create a type of that structure.
August 25, 2013
C typedef basics
If c is not your first language, you will really miss boolean primitive type. In other languages boolean is already defined, but in c there is no such type, it is actually using integer values instead.
It is really simple to implement a boolean value with typedef:
Other option is to include stdbool.h.
Using typedef as an alias makes code more readable.
The example above shows that accessing the values is along the same rules as using struct.