Hello friends,
Today we will learn how to compile and run a C program in Ubuntu using the following steps:
Step 1. Open your terminal.
Step 2. Now type the following command:
gedit cprg.c
The above command open a text editor in which you will write your c source code as follows:
#include <stdio.h>
main() {
printf("Run C program in ubuntu\n");
}
Save it and Close your text editor.
Step 3. Now type the following command on the terminal:
gcc -o cprg cprg.c
The above command compile your file and create a executable file cprg with the output(-o) of the program.
Step 4. In last step, you will execute your program with the help of following command:
./cprg
Output will be as follows:
Run C program in ubuntu
0 Comment(s)