Executing the C Program
Read first the previous part of this post PART -1. Execution is a simple task. The command
a.out
would load the executable object code into the computer memory and execute the instructions. During execution, the program may request for some data to be entered through the keyboard. Sometimes the program does not produce the desired result. Perhaps, something is wrong with the program logic or data. Then it would be necessary to correct the source program or the data. In case the source program is modified, the entire process of compiling, linking and executing the program should be repeated.
Creating Your Own Executable File
Note that the linker always assigns the same name a.out. When we compile another program, this file will be overwritten by the executable object code of the new program. If we want to prevent from happening, we should rename the file immediately by using the command.
mv a.out name
We may also achieve this by specifying an option in the cc command as follows.
cc -o name source-file
This will store the executable object code in the file name and prevent the old file a.out from being destroyed. #allaboutprogramming62
0 Comments
Ask Me Everything About Programming.