In this article I will tell you how to run C-language from Ubuntu from terminal.
first open the terminal:
then we will install gcc in order to run c-language . To install gcc type "sudo apt install gcc" in the terminal. After installing it . We will first make a file with .c extension. So we type "sudo nano filename.c" . Now write a program in C-language in the file.
Hello world program in C-language:
#include
int main() {
printf("Hello, World!");
return 0;
}
Now after writing the program click Ctrl+x to exit, after clicking Ctrl+x click y in order to save the program. Now after
exiting we will compile the file to check for errors. To compile the file type "gcc filename.c" in the terminal. then when
the compiling will finish and when there is no errors in the program. Type : "./a.out" to display the output of the program.
I hope this article helps you to run C-language in terminal.