1) Write any C program in text editor and save as filename.c
In following example, I have saved this file on my Desktop.
2) To run this program, you have to compile it first.
$ gcc -o compiled-filename /home/user/Desktop/filename.c
This will generate a compile copy of your program as a name compiled-filename in same directory where you ran the above command.
3) Now create output copy of your program.
Following command generate a output file of your program in same directory.
$ gcc /home/user/Desktop/filename.c
$ ./a.out or $ ./compiled-filename
Alternatively you can run compiled copy of your program.