I'm starting to learn programming in C, and I have this task where I have to write a program with part of the code on another file. But I'm having problems with that last part because I'm using matrices.
Here's the main body:
#include <stdio.h>
#include "otsenkatry.c"
int main()
{
int i, j;
int a[i];
int s, gru;
char A, B, C, D, E;
printf("Introduce the number os students ", &s);
fflush(stdout);
scanf("%d", &s);
printf("Introduce their grades\n");
fflush(stdout);
for (i = 0; i<s; i++)
{
printf("a[%d] = ", i);
fflush(stdout);
scanf("%d", &a[i]);
printf("Grade: %d %d \n", a, otsenkatry(a));
fflush(stdout);//}
}
return 0;
}
And that's the part with the problem:
int otsenkatry (int* a)
{
int i;
int gru;
if (a[i]<51)
{
gru=2;
}
if (a[i]>50 && a[i]<69)
{
gru=3;
}
if (a[i]>69 && a[i]<=85)
{
gru=4;
}
if (a[i]>85 && a[i]<=100)
{
gru=5;
}
return gru;
}
I figured, that it has to do with the pointers, but I don't know how to alter it.