Wednesday, January 16, 2008

The C Programming Language – A Overview of C

1.1. C as a Midle-Level Language

According to Schildt’s definition, C is classified as a middle-level language because it combines the best aspect of high-level languages with the control and flexibility of a low-level language (ex: Assembler). The C language allows manipulation of bits, bytes, and adresses. C programs in most of the time are also well know for having great portability, which means that it’s easy to convert programs written in C from one platform to another.

C is also well know for not performing much of type checking and run time error checking routines, which means that the programmer is responsible for that :P.

1.2. C as a Structured Language

One of the main characteristics of implementations build upon a structured language as C resides in the application of a concept called compartmentalization. Generally in compartmentalization we section off and hide parts of the program that are responsible for the execution of specific tasks. A good way to compartmentalize code in C is through the use of building blocks (logically connected groups of program statements between brackets ({ })) more specifically through the use of functions. I'll explain the function concepts in a different post. For now, think about functions as a special nested group of building blocks that is called (or summoned :P) to do something in the battlefi...I mean...to do something during the program execution. :)

Compartmentalization allows the use of local variables. This type of variables are defined and are meant to exists only in the building block in which they are declared, with this we can prevent some side-effects that can be really a pain.

NoteStorm: Side effect is the result of the access and alteration of some data by a specific task in which the data modified in the execution of process has nothing to do with the purpose of the task.

C’s functions are building blocks in which the main activity related to program occurs and as a matter of fact it can be considered the main structured component present in the language. With the use of such structures we can declare local variables

NoteStorm: C don’t allow definition or declaration of functions inside of other functions whatsoever. So, because of that we can say that C is a structured but not technically a block-structured language.

1.3. C as a Programming Language

As a programming language, we could say that C has few restrictions, few complaints, block structures, stand-alone functions, and a compact set of keywords and if we combine that with some good programming techniques we can achieve the perfomance that we would achieve by the use of some low-level language like Assembler combined with portability and the structure of ALGOL or Modula-2.

1.4. The Form of a C Program

All C programs consists of one or more functions and an undetermined number of function calls. The function that must exist no matter the case in a C program must be denominated as “main”. The main function is the first function that’s called during the execution of a C program. And normally it has, in between its brackets, only function calls. Those calls can give us an outline of the program.

Example:


1.5. The Library and Linking

There are a set of functions (a library) that every C compiler must have in order to meet the standard specifications defined for the C language.

You can use the functions from the standard function library from C in your program through the use of a process know as
linking. The linker combines our code with the code from the standard library.

NS: The C++ language inherits the standard library from the C language.

Both C and C++ allow us to separate our program in many files. During the linkage process, the program code contained in all the files is linked along with the library routines's code to form the object code.

1.6. c and cpp Extensions

Briefly speaking, .c and .cpp are the extensions of files that contains C and C++ programs respectively. It's important to say, right now, that there are some and sometimes great differences between programs written in C and programs written using C++. Those differences will become clear as we advance through the tutorials.

I would gladly accept any opinion about the subject, cuzz clearly I'm not an expert in it, neither in english, so if anyone that is more experienced in both areas of knowledge want to share some information please don't hold yourself. >:)



Samuel

1 comment:

gary Z said...

gud work with the tutorials man ...thy r well organised ... keep them comin...