hi i am really new to this and can't see why i can't get my code to work, it is probily really silly but help would be appreciated.
i am trying to get the user to enter the number of competators of a 4 lap race so that it can determine the lap size then read in the lap times of each competator.
# include <stdio.h>
# include <malloc.h>
/* define the structure , what you want the user to input*/
struct laptimes {
float lap1;
float lap2;
float lap3;
float lap4;
};
int main (){
int comp ;
int n;
printf("Enter number of competators \n");
scanf("%d",&n);
comp = calloc (n,sizeof (int));
/* allocating the pointer to the memory space*/
int p;
struct laptimes * ptr = &p;
p = malloc (sizeof(int));
/* asking the user to input lap times. Scan in the user input then print it back out to the user*/
printf("Enter lap times \n ");
scanf("%f%f%f%f",(*ptr).lap1,(*ptr).lap2,(*ptr).lap3,(*ptr).lap4);
printf("%f%f%f%f",(*ptr).lap1,(*ptr).lap2,(*ptr).lap3,(*ptr).lap4);
free();
return 0 ;
}