I wrote some c code in a file and saved it with gedit.
I then opened the terminal and tried compiling it with gcc but it gives me an error that it does not recognize the format of my c file.
What format does gcc read?
gcc uses the file extension (suffix) to determine the type - did you name your file with a .c suffix? If not, try renaming it - for example if I have a file called 'testc'
$ cat testc
#include<stdio.h>
int main()
{
printf("THIS is a C-file\n");
return 0;
}
Then
$ gcc -o test testc
testc: file not recognized: File format not recognized
collect2: ld returned 1 exit status
But after renaming to a proper .c file
$ mv testc test.c
$ gcc -o test test.c
$
$ ./test
THIS is a C-file