Useful Free Resources

Monday, September 7, 2015

The IPOS Cycle

The IPOS cycle represents the four basic tasks of any computer:
  • input : Input is obtaining data from the outside world and delivering it to one or more components in the computer.
  • processing : Processing is the execution of one or more computer programs on the data. Processes can vary greatly in size, complexity, and function,  i.e. Processes will often perform mathematical operations, string operations, computer graphics, storage operations, and/or operating system activities.
  • output : Output is taking information stored in the computer and
    delivering it to the outside world, usually for humans to view.You might think of input as the raw data for a process and output as the results of the process.
  • storage : Storage is applied today to both data and program code. Storage usually refers to secondary storage, that is, the permanent placement of information on a device like a disk, but it can also refer to temporary storage in some form of memory such as main memory (RAM) or short-term storage such as registers and cache.
The IPOS cycle
 Although a computer will do all four of these, it is not necessarily the case that all four of them are done in this sequence. For instance, a program may require some input followed by processing followed by additional input followed by more processing.
Also, results from a process can either be output or stored in a file, thus omitting either output or storage.




Resources


Linux with Operating System Concepts by Richard Fox

Saturday, August 29, 2015

Running With RAPTOR

When developing a program, it is essential to plan out the program, normally using pseudocode. RAPTOR  allow you to practice this pseudocode and give you a chance to see a “real-life” application of programming skills.

RAPTOR is a visual programming environment based on flowcharts that are created to solve particular programming problems.
Normally, programmers use flowcharts to design a program or part of a program before writing the actual code. RAPTOR allows you to take flowcharting one step further by allowing you to test (run) your program design and to confirm that your logic works correctly to solve your problem.
In a programming logic course, RAPTOR is useful for several reasons. Compared with other programming languages, the RAPTOR language has minimal syntax (grammar), which means you spend less time learn it and debugging syntax errors.
You can concentrate on the most important aspect of programming: developing good logic and design. Also, the RAPTOR program is visual because it uses diagrams that allow you to understand the flow of control of the statements in your program.
RAPTOR screens
Several versions of RAPTOR are available. Download the last release (actually 4.0.6.004 from FALL 2014 VERSION (Updated 22 April 2015)) exist also portable version  and older releases too.
After you download and install RAPTOR, you can open the program by locating the little RAPTOR icon on your computer. You will see two screens(see Figure):
  • the RAPTOR work area screen 
  • and the MasterConsole screen .
When you first open RAPTOR your MasterConsole may be shrunk or hidden behind the main screen and you may have to click it to reveal it. You can resize the screens as you wish; it’s convenient to view them side-by-side.

When you execute a RAPTOR program you're in main tab, the program begins(refer to Work area) at the Start symbol at the top and follows the arrows to the End symbol(that's a template one can delete that symbols).
That's the smallest RAPTOR program (which does nothing). By placing additional RAPTOR statements between the Start and End symbols you create more meaningful RAPTOR programs.

 Prompts you after drag one symbol onto
the  Work area
To create a RAPTOR program, you drag instances(after dragging the flowcharting symbol change his colour from blue to red to show you the actual status) of each flowcharting symbol from the left side to the middle area(the joint point is shown trough a change in the mouse shape from ? to normal with a + to the right then you can drop the symbol) of the screen, as shown in Figure. RAPTOR will prompt you to save your file as soon as you drag one symbol onto the screen(Work area). Then you can begin to create your program. 

Backups

RAPTOR makes backup files of your programs automatically. After you work on a program for some time, if you look in Windows Explorer or MyComputer, you will see a group of files under your RAPTOR file. The RAPTOR file has the extension .rap and is identified by the RAPTOR icon. The backup files are named with the same name as your program but include .backup0, .backup1, and so on.
These files can be ignored and, when you are finished creating your program, can be deleted.
Entering information into a dialog box
To enter information into a symbol that you have dragged to the screen, double-click it. A dialog box (a small window) will open, which allows you to enter the information that is possible or required for that symbol. E.g. for an Assignment box, as shown in Figure, double-clicking the box will open the dialog box. Assignment boxes allow you to enter information about variables.


Variables

The identifiers in raptor aren't case sensitive so the identifier x is considered the same as X , so the statement Set X = 32 assigns the value of 32 to the variable named X.
In RAPTOR, an arrow (in Ubuntu can't notice any arrow except a space between an R-value and L-value) pointing left  assigns the value on the right-hand side to the variable named on the left-hand side. Therefore, X  32 assigns the value of 32 to the variable named X.
In Figure, the box directly under the Start symbol (X  32) assigns the value 32 to the variable X.
The next statement, X  X + 1 says “X now is assigned the value it had (32) plus 1.” So, after that statement executes, the previous value of
X is replaced by the value 33.
The next statement, X  X * 2 says “assign to the variable X the present value of X multiplied by 2.” In this case, X had the value 33 and, after the statement is executed, it contains the value 66(Notice it in the Watch window).
All RAPTOR variables are of type Number or String.
A Number can be either a whole number (an integer) or a decimal number (a floating point number).
RAPTOR does not distinguish between number types.
A String is a text value into " ", like "Hello, friend" or "pony" or a single character like "e" or "W" or even a number, as long as the number is not used for any computations. For example, a ­ telephone number such as "352-381-3829" is a String.
A variable can have its value set or changed/updated in RAPTOR by one of the three ways:
  • The value can be entered from an Input statement
  • The value can be calculated from an equation in an Assignment statement
  • The value can be returned from a procedure Call (more on this later)
As in most languages, it’s necessary to associate several things with a new variable.
A variable must be given:
  • a name, 
  • a data type, 
  • and often an initial value.

Declaring variables

When a RAPTOR program begins its execution, no variables exist. The first time RAPTOR encounters a new variable name, it automatically creates a new memory location and associates this variable name with the new memory. Therefore, in RAPTOR you don’t need to declare variables explicitly, as we probably do in the pseudocode with Declare statements.
The variable will exist from the point at which it is created in the program execution until the program terminates.

Initializing variables

Attempts to use a variable named X before it is created(had
been assigned any value).
When a new variable is created in RAPTOR, it must be given an initial value. This is slightly different from other languages where it is possible to declare a variable without giving it a value at that time.
The initial value in RAPTOR determines the variable’s type. If the value is a number, the variable is of type Number. If the initial value is text, the variable is of type String.
Note that any initial value that is enclosed in quotes is considered text(String) e.g. :
  • If the variable myNum is set to 34, it is stored with the Number type.
  • If the variable myWord is set to "34", it is stored with the String type.
A variable’s data type cannot change during the execution of a program.
Beware! While a variable in RAPTOR can be created “on the fly” (i.e., by simply entering a variable name and giving it a value), a variable cannot be used until it has been created(see Figure).

Common Errors and Their Causes

     The variable Y has not been given a value
Error 1: Variable ____ doesn't have a value.

There are two common reasons for this error:







     The variable (Mile) name is misspelled













Error 2: Variable ___ not found!
This error means you have tried to use a variable before you have declared it or assigned it an initial value(like the first case in Error 1).

Error 3: Can’t assign string to numeric variable _____.
Can’t assign numeric to string variable _____.

This error occurs if your statements attempt to change the data type of a variable.
In newer versions of RAPTOR, you may be allowed to change a data type “on the fly” but this is never a good programming practice.













RAPTOR Symbols

 3 of the 6 RAPTOR symbols and instructions
Now lets provide details about each of the basic symbols: Input,
Assignment, and Output. The other symbols will be covered later.






Input Symbol

Every programming language has statements that enable the program to get information from the user via the keyboard or mouse and display that information on the computer screen. This allows the user to enter instructions to the program or supply the program with necessary information.
In RAPTOR, when an Input symbol is executed, a prompt(as dialog window) is displayed prompting the user to enter some value; the user then enters a value which is stored in a given variable. The Enter Input dialog box (see Figure ) shows what is displayed when you drag an Input symbol onto your flowchart and double-click in the symbol.
In the Enter Prompt Here box at the top, you enter the text you want the user to see. The text typed in this box will be displayed to the user when the program is run and, therefore, should explain what information needs to be input. This text must be enclosed in quotes. Make sure your prompt is clear and complete.
The Enter ­Variable Here box holds the name of the variable where the information the user enters will be stored. You can enter the name of a variable you have previously declared or you can declare a new variable and enter it here.
  • The information entered will be stored in a variable and used later in the program. For example, if you are calculating the cost of buying widgets and the user enters $1.50 for the price of one widget, this will be stored in a String variable called Price; the dollar sign ($) prevents it from being considered a Number. This will give you an error when you use Price in a calculation. Since Price must be a Number, the dollar sign cannot be part of the user’s
    entry. Be sure to tell the user not to include units when entering numbers.
    For example, a good prompt might read, "Enter the price of a widget, without the $ (i.e., 1.50 for a widget that costs $1.50)."
     
  • If you are asking the user to enter a text response, you must be specific. For example, if you want the user to choose yes or no, you must tell the user what to type because, to a computer, "yes" is not the same as "y" or "YES". A good prompt for this example might read, "Do you want to continue? Type 'y' for yes or 'n' for no."


Nested Quotes

At this point it is helpful to point out a situation that occurs frequently when coding an output text. Imagine you want the following output to explain to the user how to enter a choice:
Do you want to play the game again? Type "y" for yes, "n" for no.
Often the output includes some text that needs to be wrapped in quotes. However, a String, to the computer, is any text enclosed in quotes. The computer understands that the beginning of a String starts with the first quote symbol (") and ends when it encounters a second quote symbol ("). If the output text shown above was to be stored in a variable named YourChoice and was coded as follows:
YourChoice = "Do you want to play the game again? Type "y" for yes,
"n" for no."
the computer would process "Do you want to play the game again? Type" as the String to be stored in YourChoice and then display an error because the next character, y, is unintelligible to a computer interpreter or compiler.
That is why we not must nest quotes within a String. We must use a different symbol for internal quotes (those that are part of the String text) than the outer quotes, which mark the beginning and end of the String. In this case, a single quote (') indicates that we are still inside the original text String. In some languages, the outer quotes must be double quotes ("), while in other languages double quotes can be nested inside single quotes as well as the other way around.
The correct way to write the code for the YourChoice variable, then is:
YourChoice = "Do you want to play the game again? Type 'y' for yes,
'n' for no."

Using the Input Box to Change the Value
of a Declared Variable



















Using the Input Box to Declare and Initialize
a Variable





















Assignment Symbol

The Assignment symbol is used to set the value of a variable or to perform a computation and then store the results in a variable. The value stored in the variable can be retrieved and used in a statement later in the program.
The dialog box shown in Figure is used to enter the name of the variable being assigned and its value.
The variable name is entered in the small text box: Set ________.
The value is entered in the large text box: to ________. This value can be a number, character, or a string of text. If this is the first time the variable has been used, its type is set by the value you enter. If you type a number, the variable becomes a Number type.
You can also type in a computation for the value of a variable. The result will be assigned to the variable.

Here is how RAPTOR processes an Assignment statement:
  • First, the expression on the right-hand side of the Assignment operator is evaluated.
  • Then, that value is placed in the memory location associated with the variable on the left side, replacing whatever data value had been stored there previously.

Expressions

The expression (or computation) of an Assignment statement can be any simple or complex equation that results in a single value. An expression is a combination of values (either constants or variables) and operators. A computer can perform only one operation at a time. RAPTOR follows the same mathematical order as used in other languages.
An operator or function directs the computer to perform some computation on data. Operators are placed between the data being operated on (e.g., X + 3), whereas functions use parentheses to indicate the data they are operating on (e.g., sqrt(4.7)).
When executed, operators and functions perform their computation and return their result. The result of evaluating an expression in an Assignment statement must be either a single number or a single string of text. While many expressions will compute numbers, you can also perform simple text manipulation in RAPTOR by using a plus sign (+) to join (concatenate) two or more strings of text into a single string. You can also join numerical values with strings to create a single string. The following Assignment statement demonstrates string manipulation:
Full_name  = "Joe " + "Alexander " + "Smith"
The value of Full_name, after this Assignment statement, is Joe Alexander Smith.

Output Symbol

In RAPTOR, an Output statement displays a value to the MasterConsole screen when it is executed.
When you define an Output statement by clicking on the Output symbol in your flowchart, the Enter Output dialog box asks you to specify the text or expression to display and whether or not the output should be terminated by a newline character.
If you check the End current line box, any future output will start on a new line below the displayed text.
You can output text, the value of a variable, or any combination of text and variables.
Note: For the user we cannot just list the values of the variables; we need to add some explanation of what these values represent in the MasterConsole screen.

Comments

The RAPTOR development environment, like many programming languages, allows comments to be added to your program. All good programs include comments if the code itself is not self-explanatory. While in the beginning, comments often seem redundant or even downright silly since beginning programs are small and not particularly complex, it is a good idea to get into the habit of including comments.
To add a comment to a symbol in your flowchart, right-click the mouse button on the statement symbol(rclick in Linux get mostly in an unhandled exception so use Edit > Comments in Menu bar ) and select the Comment line before releasing the button. Then, enter the comment text into the Enter Comment dialog box. The resulting comment can be moved in the RAPTOR window by dragging it, but normally you would not need to move the default location of a comment.
Typically, you should not comment every statement in a program but should include comments before each new section of a program.

Documentation Is Always Important

Often a program can achieve the desired results in one of several ways. The decision about which code to use is up to you, the programmer. While many examples are short and simple,real programs may be much longer and more complicated.
P­rofessional programmers often work on code written by other people. It is easier for a programmer to edit someone else’s code if the programmer knows what the segment is designed to do. This is one reason why it is so important to use documentation in the form of comments to explain what your code is doing.

The Assignment Operator and the Comparison Operator in RAPTOR

RAPTOR allows you to use either a single or a double equals sign to indicate a comparison within a test condition. RAPTOR “understands” that a single equals sign indicates comparison by its placement in the diamond shape. RAPTOR also accepts the double equals sign as a comparison operator.
For example, if the condition you wish to check is “Is the value of Count equal to 5?” you could enter either of the following into the Enter Selection Condition  Count = 5 or Count == 5 . 
It's better use the double equals sign to indicate a comparison because it
is an important distinction which, in a typical programming language, can wreak havoc on a program if used incorrectly.

The Call Symbol and Subcharts

The Call symbol, is used to call submodules from the main program, as these submodules, named subcharts in RAPTOR, are needed.
Subcharts help break a RAPTOR program into logical parts, called as needed by the main program, to simplify design, ensure that flowcharts are manageable, and reduce the chance for errors.

When you start a RAPTOR program, you’ll see a main tab in the upper-left corner of the work area. To create a subchart, simply right-click the main tab and select Add subchart from the menu. Enter the name of your subchart and a new editing window will appear. The name you give your subchart is automatically created in this new window after you click yes when prompted.
 a new subchart named Calculations
Now you can begin to build your subchart. After you have created your program, to call a subchart, simply insert the Call symbol where you want it in your program(main tab), and enter the name of the subchart that you want it to be called.

A subchart may be called from the main flowchart or from other subcharts or even from within itself but be careful if you decide to try this! It can easily result in an infinite loop (a loop that runs forever).
As the program runs, when the Call is encountered, control will transfer to the subchart. After all the steps in the subchart are completed, control will automatically return to the next symbol after the Call.

In RAPTOR, each variable declaration uses a separate Assignment symbol. Initializing more than a few variables results in a long list of Assignment boxes that do not have much to do with the logic of the program. Therefore, for convenience, we can call a RAPTOR subchart as soon as the program begins, which will contain all our initial variable declarations. It keeps this long list of Assignment boxes out of the way and allows us to focus on the rest of the program.
You will now see your main work area and a new tab at the top, named Variables. You can click on the Variables tab and begin creating variables.
However, it is not necessary and, if you wish, you can initialize your variables in the main program. Since a variable’s data type in RAPTOR is created when the variable is given a value, we will create most of our number variables by giving them an initial value of 0 and most string variables by giving them an initial value of an empty space (" "). Some variables, our named constants, have predetermined values that will not change as the program runs. We can set these values now.
Testing the program at each submodule makes debugging a great deal easier than waiting for the end when you have many more combinations of tests to run and where it may be difficult to pinpoint the source of a bug. In RAPTOR, as you run your tests, look at the watch window on the left side to be sure that your variables are being assigned the correct values.


Resources

Wednesday, August 19, 2015

The C Language : History and Standards(till C99)

Dennis Ritchie designed the C language at Bell Laboratories  from 1969 to 1973, and its ancestry is traced from
  1. ALGOL 60 (1960)
  2. Cambridge's CPL (1963)
  3. Martin Richards's BCPL (1967)
  4. and Ken Thompson' s B language (1970) at Bell Labs 
 The American National Standards Institute (ANSI) ratified the ANSI C standard in 1989, and this standardization later became the responsibility of the International Standards Organization (ISO).
The standards define the C language and a set of library functions known as the C standard library.
Kernighan and Ritchie describe ANSI C in their classic book, which is known affectionately as “K&R”. In Ritchie’s words ,
C is “quirky, flawed, and an enormous success.” 
So why the success?

  • C was closely tied with the Unix operating system. C was developed from the beginning as the system programming language for Unix. Most of the Unix kernel, and all of its supporting tools and libraries, were written in C. As Unix became popular in universities in the late 1970s and early 1980s, many people were exposed to C and found that they liked it. Since Unix was written almost entirely in C, it could be easily ported to new machines, which created an even wider audience for both C and Unix
  • C is a small, simple language.The design was controlled by a single person, rather than a committee, and the result was a clean, consistent design with little baggage. The K&R book describes the complete language and standard library, with numerous examples and exercises, in only 261 pages.
    The simplicity of C made it relatively easy to learn and to port to different computers.
  • C was designed for a practical purpose. C was designed to implement the Unix operating system. Later, other people found that they could write the programs they wanted, without the language
    getting in the way.


Although C is a general-purpose programming language, it has traditionally been used for (operating) systems programming. In particular, the popular UNIX operating system was originally written in C.
C's popularity is due to many factors. It is a:
  • small
  • efficient, yet powerful programming language 
  • with a rich(in 70's) run-time library
  • It provides precise control over the computer without a lot of hidden mechanisms
  • Since it has been standardized for over 25 years, programmers are comfortable with it. It is generally easy to write C programs that will be portable across different computing systems in different countries with different languages
  • Finally, there is a lot of legacy C code out there that is being modified and extended
Starting in the late 1990s, C's popularity began to be eclipsed by its "big brother," C++. However. there is still a loyal following for the C language, and it continues to be popular where programmers do not need the features in C++ or where the overhead of C++ is not welcome.

C has withstood the test of time. It remains a language in which the experienced programmer can write quickly and well. Millions of lines of code testify to its usefulness.

C is the language of choice for system-level programming, and there is a huge installed base of application-level programs as well.

However, it is not perfect for all programmers and all situations.
  1. C pointers are a common source of confusion and programming errors. 
  2. C also lacks explicit support for useful abstractions such as classes, objects, and exceptions. Newer languages such as C++ and Java address these issues for application-level programs.


THE EVOLUTION OF C

In the mid of 80's , the C language was in widespread use, but there was no official standard or precise description of the language. The de facto standards were the C compilers being used.
C became an international standard in 1989, was revised in 1994, and underwent a major revision in 1999.
Unfortunately simply changing the definition of a language does not automatically alter the hundreds of millions of lines of C program code in the world.

Traditional C

The original C language description is the first edition of the book,
The C Programming Language, by Brian Kernighan and Dennis Ritchie (Prentice-Hall, 1978), usually referred to as "K&R." 
After the book was published, the language continued to evolve in small ways; some features were added and some were dropped.
We refer to the consensus definition of C in the early 1980's as traditional C, the dialect before the standardization process.
Of course, individual C vendors had their own extensions to traditional C, too.

Standard C (1989)

Realizing that standardization of the language would help C become more widespread in commercial programming, the American National Standards Institute (ANSI) formed a committee in 1982 to propose a standard for C and its run-time libraries. That committee X3J11 (now NCITS J11 ), was chaired by Jim Brodie and produced a standard formally adopted in 1989 as American National Standard X3.159-1989, or "ANSI C."

Recognizing that programming is an international activity, an international standardization group was created as ANSI C was being completed. 
ISO/IEC JTCl/SC22/WG14 under by P. J. Plauger turned the ANSI standard into an international standard, lSO/IEC 9899:1990, making only minor editorial changes. The ISO/IEC standard was thereafter adopted by ANSI, and people referred to this common standard as simply "Standard C" Since that standard would eventually be changed, we refer to it as Standard C (1989), or simply "C89".
Some of the changes from traditional C to C89 included:
• The addition of a truly standard library.
• New preprocessor commands and features.
• Function prototypes, which let you specify the argument types in a function declaration.
• Some new keywords, including const, volatile, and signed.
• Wide characters, wide strings, and multibyte characters.
• Many smaller changes and clarifications to conversion rules, declarations, and type checking.

Standard C (1995)

As a normal part of maintaining the C standard , WG14 produced two Technical Corrigenda (bug fixes) and an Amendment (extension) to C89. Taken together, these made a relatively modest change to the Standard mostly by adding new libraries
The result is what we call either "C89 with Amendment I" or "C95." 
The changes to C89 included:
• three new standard library headers: iso646.h, wctype.h, and wchar.h
• several new tokens and macros used as replacements for operators and punctuation characters not found in some countries's character sets
• some new formatting codes for the printf/scanf family of functions, and
• a large number of new functions, plus some types and constants, for multibyte and wide characters.

Standard C (1999)

ISO/IEC standards must be reviewed and updated on a regular basis. In 1995 WGI4 began work on a more extensive revision to the C standard, which was completed and approved in 1999. The new standard, ISO/IEC 9899:1999, or "C99," replaces the previous standard (and all corrigenda and amendments) and has now become the official Standard C.
Vendors are updating their C compilers and libraries to conform to the new standard.
C99 adds many new features to the C89/C95 language and libraries, including:
• complex arithmetic
• extensions to the integer types, including a longer standard type
• variable-length arrays
• a Boolean type
• better support for non-English character sets
• better support for floating-point types, including math functions for all types
• C++ style comments (/ /)
C99 is a much larger changeset than C95 since it includes changes to the language as well as extensions to the libraries. The C99 Standard document is significantly larger than the C89 document. However, the changes are "in the spirit of C," and they do not change the fundamental nature of the language.

Standard C++

C++, designed by Bjarne Stroustrup at AT&T Bell Labs in the early 1980s, has now largely supplanted C for mainstream programming. Most C implementations are actually C/C++ implementations, giving programmers a choice of which language to use.
C++ has itself been standardized, as ISO/lEC 14882:1998, or "Standard C++."
C++ includes many improvements over C that programmers need for large applications. including improved type checking and support for object-oriented programming. However, C++ is also one of the most complex programming languages, with many pitfalls for the unwary.
Standard C++ is nearly- but not exactly- a superset of Standard C. Since the C and C++ standards were developed on different schedules, they could not adapt to each other in a coordinated way.
Furthermore, C has kept itself distinct from C++. For example, there has been no attempt to adopt "simplified" versions of C++'s class types.
It is possible to write C code in the common subset of the Standard C and C++ languages -called Clean C by some- so that the code can be compiled either as a C program or a C++ program (i.e. write Standard C code so that it is acceptable to C++ compilers).
Since C++ generally has stricter rules than Standard C, Clean C tends to be a good, portable subset in which to write.
The major changes you must consider when writing Clean C are:
• Clean C programs must use function prototypes. Old-style declarations are not permitted in C++.
• Clean C programs must avoid using names that are reserved words in C++, like class and virtual.

WHICH DIALECT OF C SHOULD YOU USE?

Which dialect of C you use depends on what implementation(s) of C you have available and on how portable you want your code to be. Your choices are:
1. C99, the current version of Standard C. It has all the latest features, but some implementations may not yet support it. (That will change rapidly anyway.)
2. C89, the previous version of Standard C. Most  C programs and most C implementations are based on this version of C, usually with the Amendment I additions.
3. Traditional C, now encountered mostly when maintaining older C programs.
4. Clean C, compatible with C++.
C99 is generally upward compatible with C89, which is generally upward
compatible with traditional C.
Unfortunately, it is hard to write C code that is backward compatible. Consider function prototypes, for example. They are optional in Standard C, forbidden in traditional C, and required in C++. Fortunately, you can use the C preprocessor to alter your code depending on which implementation is being used-and even on whether your Standard C includes the Amendment 1 extensions-. Therefore, your C programs can remain compatible with all dialects.
If you are not limited by your compiler or an existing body of C code, you should definitely use Standard C as your base language. Standard C compilers are now almost universally available.
e.g. The Free Software Foundation's GNU C (gcc) is a free Standard C implementation (with many extensions).

AN OVERVIEW OF C PROGRAMMING

Let's do a quick overview of C programming.
A C program is composed of one or more source files, or translation units, each of which contains some part of the entire C program -typically some number of external functions-. 
Common declarations are often collected into header files and are included into the source files with a special #include directive/command. 
One external function must be named main(); this function is where your program starts(the entry point).
A C compiler independently processes each source file and translates the C program text into instructions understood by the computer(object code). 
The compiler "understands" the C program and analyses it for correctness. If the programmer has made an error the compiler can detect, then the compiler issues an error message. Otherwise, the output of the compiler is usually called object code or an object module.
When all source files are compiled, the object modules are given to a program called the linker. The linker resolves references between the modules, adds functions from the standard run-time library, and detects some programming errors such as the failure to define a needed function. 
The linker is typically not specific to C; each computer system has a standard linker that is used for programs written in many different (compiled) languages.
The linker produces a single executable program. which can then be invoked to run. Although most computer systems go through these steps, they may appear different to the programmer.
In integrated environments such as Microsoft's Visual Studio, they may be completely hidden.

Example

Suppose we have a program to be named aprogram consisting of the two C source files hello.c and startup.c
The file hello.c might contain these lines:
#include /* defines printf  */
void hello (void)
{
   printf("Hellol\n"};
}
Since hello.c contains facilities (the function void hello (void)) that will be used by other parts of our program, we create a header file hello.h to declare those facilities. It contains the line extern void hello{void};
File startup.c contains the main program, which simply calls function hello:
#include "hello.h"
int main (void)
{
  hello () ;
  return 0;
}
On a UNIX system, compiling, linking, and executing the program takes only two steps in a shell:
user@host:~$ gcc -o aprogram hello.c startup.c
user@host:~$ ./aprogram
The ftrst line(the part after the prompt -in italics- ) compiles and links the two source files, adds any standard library functions needed, and writes the executable program to file aprogram
The second line then executes the program, which prints: Hello!

Other non-UNIX implementations may use different commands. Increasingly, modern programming environments present an integrated, graphical interface to the programmer. Building a C application in such an environment requires only selecting commands from a menu or clicking a graphical button.


CONFORMANCE

Both C programs and C implementations can conform to Standard C. 
A C program is said to be strictly conforming to Standard C if that program uses only the features of the language and library described in the Standard. The program's operation must not depend on any aspect of the C language that the Standard characterizes as unspecified, undefined, or implementation-defined. There are Standard C test suites available from Perennial, Inc. and Plum Hall, Inc. that help establish conformance of implementations to the standard.
There are two kinds of conforming implementations-hosted and freestanding-. 
  • A C implementation is said to be a conforming hosted implementation if it accepts any strictly conforming program. 
  • A conforming freestanding implementation is one that accepts any strictly conforming program that uses no library facilities other than those provided in the header files float.h, iso646.h(C95), limits.h, stdarg.h, stdbool.h(C99), stddef.h , and stdint.h(C99).  
Freestanding conformance is meant to accommodate C implementations for embedded systems or other target environments with minimal run-time support. For example,such systems may have no file system.
A conforming program is one that is accepted by a conforming implementation.
Thus, a conforming program can depend on some non portable, implementation-defined features of a conforming implementation, whereas a strictly conforming program cannot depend on those features (and so is maximally portable).

Conforming implementations may provide extensions that do not change the meaning of any strictly conforming program. This allows implementations to add library routines and define their own #pragma directives, but not to introduce new reserved identifiers or change the operation of standard library functions.
Compiler vendors continue to provide non-conforming extensions to which their customers have grown accustomed. Compilers enable (or disable) these extensions with special switches.


Resources:

C A REFERENCE MANUAL : Samuel P. Harbison III, Guy L. Steele Jr.