Linux:How to run c program in linux

1. Open an editor in linux Example vi editor
2. Write a simple program and save it as progra1.c

  #include <stdio.h>
  int main (void)
printf ("Programming is fun.\n");
return 0;

3. compile the program : $ gcc prog1.c
4. Run the program : ./a.out
Or can give it a different name : gcc prog1.c –o prog1
Now run the program by typing : prog1

Leave a Reply