1. Open your terminal window using
Ctrl + Alt + T
2. Make directory for all c program you going to do
mkdir c_program
3. Go to C_program directory and create directory for first program
cd c_program
mkdir first_program
4. Go to the first_program and create the file to write your program
cd first_program
gedit first_prog.c
5. It will open the editor to enter the program, enter the following code in the editor
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("\n This Is My First C Program Under Linux\n");
return 0;
}
6.
6. Save and exit from the editor
7. Compile the program with gcc compiler, format of the compilation should be gcc -o <output_file_name> <your_program.c>
gcc -o output first_prog.c
8. run the output
./output
9. You will get following as the output
This Is My First C Program Under Linux
10. Enjoy!
No comments:
Post a Comment