I am new to C language. I'm currently trying to create an algorithm to make a rank of scores, following a textbook. This is a code shown in the textbook.
struct data{
int rank;
int score;
};
void rank1 (struct data *x, int n)
{
int i, j;
for ( i = 0 ; i < n; i++ )
x [i]. rank = 1;
for (i=0;i<n;i++)
for (j=0;j<n;j++)
if(x [i].score < x [j].score)
x [i].rank++;
}
Then I got an error saying below.
[Running] cd "c:\Users\soohk\OneDrive\desktop\programming\edition 1\" && gcc tempCodeRunnerFile.c -o tempCodeRunnerFile && "c:\Users\soohk\OneDrive\desktop\programming\edition 1\"tempCodeRunnerFile
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(main.o):(.text.startup+0xc0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
What can I do for this situation?