Compile and Run first C program
Approaching the steps of compiling and running your first C program can be quite interesting and intriguing!
When a C program is executed or run, online C compilers are touted to create some specific files with the C program file names. Though, they will use different extensions.
So, in order to compile or run your first C program, you need to go through certain essential steps. This will help you run your program in a more efficient way.
To help you in this regard, we have come up with this tutorial. Stay on the said subject and fill your knowledge base with the right information.
Compilation of a C Program - An Overview
Compilation is regarded as the process that converts the C language source code to the machine code. As C is considered as the mid-level language, the compiler is required to convert it into the executable code for running the program on a machine.
First C program
Before you start the study of C language, you should know about how to write, compile and run your first C program. For better understanding of online C compilers you should know about running of the programs.
For writing your first C program, you need to open the required C console to write the below-mentioned code:
#include stdio.h
Int main(){
Printf ( “ Hello C language”);
Return 0;
}
Int main() is the main function that is considered as the entry point for all the programs. Whereas, the printf() is useful to print the needed data on a console. However, return 0 basically returns the desired execution system.
Ways to Compile and Run First C Program
In order to compile and run your first C program, you can adopt two essential ways which are discussed below:
By Menu: You can easily click on the compile menu and then the compile sub menu in order to compile your C program
By Shortcuts: After this, you can also press ctrl+f9 keys in order to compile or run your program directly
You can view the user screen directly by pressing the keys, alt+f5. Then press the ESC key to get back to the console.
Steps to Compile a C Program
Using an IDE or Turbo C++
When you are a first time programmer who is trying to run the program, you can use Turbo C and C++ as the IDEs. for C programming, it is considered as one of the oldest IDEs that is available freely on the internet.
For that, you can use the following steps:
Step 1: First, open the IDE, turbo C. Then click on the file and then click on new option
Step 2: you need to write the program ‘ Hello World’
Step 3: Then, you can click on the compile menu. And, after that, you can click on the compile option. You can press the key Alt + f9 in order to compile your code
Step 4: Then, you can click on the run menu. Then press the ctrl+f9 keys in order to run your code. C programs will be first compiled in order to generate the object code. You can run the object code easily.
Step 5 : Get the output
Comments
Post a Comment