Chapter 1.6 - Recognize the programming style of C language | Part - 1



UNIX SYSTEM - Creating the program

Once we load the operating system into the memory, the computer is ready to receive the program. The program must be entered into the file. The file name can consist of letters, digits and special characters, followed by a dot and a letter C. Examples of valid file names are:

                               hello.c 
                               program.c
                               ebgl.c


The file is created with the help of a text editor, either ed or vi. The command for the calling editor and creating the file is
                               
                               ed filename 




If the file existed before, it is loaded. If the files do not exist, the file has to be created so that it is ready to receive the new program. Any correction in the program is done under the editor. (The name of your system's editor may be different. Check your system manual.)


   
      
When the editing is over, the file is saved on the disk. It can then be referenced any time later by its file name. The program, that is entered into the file is known as a source program since it represents the original form of a program. 

UNIX SYSTEM - Creating the program

Compiling and Linking 

Let us assume that the source program has been created in a file named ebg1.c. Now the program is ready for compilation. The compilation command to achieve this task under UNIX is

                                       cc ebgl.c



The source program instructions are now translated into a form that is suitable for execution by the computer. The translation is done after examining each instruction for its correctness. If everything is alright, the compilation proceeds silently and the translated program is stored on another file with the name ebg1.o. This program is known as object code.




Linking is the process of putting together other program files and functions that are required by the program. For example, if the program is using exp() function, then the object code of this function should be brought from the math library of the system and linked to the main program. Under UNIX, the linking is automatically done (if no errors are detected) when the cc command is used. 



      Solve Turbo C++ Common Issues             

If any mistakes in the syntax and semantics of the language are discovered, they are listed out and the compilation process ends right there. The errors should be corrected in the source program with the help of an editor and the compilation is done again. 


The compiled and the linked program is called the executable object code and it stored automatically in another file name a.out.
Note that some system uses different compilation command for linking mathematical functions. 
                               
                           cc filename - 1m

is the command under UNIPLUS SYSTEM V operating system. #allaboutprogramming62

Post a Comment

0 Comments