Can anyone tell me whats wrong with the code. I get two errors. I dont know how to fix it
#include<stdio.h>
typedef struct
{
int i;
float f;
} STR;
void fun(FILE*, int);
void main()
{
STR* sp;
int x;
printf("Enter number of record to be printed: ");
scanf("%d", &x);
sp = fopen("SAMPLE.DAT", "rb");
fun(sp, x);
}
void fun(FILE* sp, int x)
{
int data;
int i;
if(ferror(sp))
printf("Error Occured");
else
{
while(!feof(sp))
{
fread(&data,sizeof(int),x,sp);
printf("%d %f",data->i, data->f);
}
}
return;
}