#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argc[]){
struct appointmentT{
int hours;
int minutes;
char description[30];
};
int dif_hours, dif_mins;
typedef struct appointmentT *appointmentT_ptr;
typedef struct appointmentT *appointmentT_ptr2;
appointmentT_ptr=(struct appointmentT*)malloc(sizeof(struct appointmentT));
if(appointmentT_ptr==NULL){
printf("no memory");
return(1);
}
appointmentT_ptr2=(struct appointmentT*)malloc(sizeof(struct appointmentT));
if(appointmentT_ptr2==NULL){
printf("no memory");
return(1);
}
printf("Enter first appointment's info:\n");
scanf("%d:%d %s", &(*appointmentT_ptr).hours, &(*appointmentT_ptr).minutes, &(*appointmentT_ptr).description);
printf("Enter second appointment's info:\n");
scanf("%d:%d %s", &(*appointmentT_ptr2).hours, &(*appointmentT_ptr2).minutes, &(*appointmentT_ptr2).description);
dif_mins=(*appointmentT_ptr).minutes-(*appointmentT_ptr2).minutes;
dif_hours=(*appointmentT_ptr).hours-(*appointmentT_ptr2).hours;
if(dif_mins<0){
dif_hours--;
dif_mins=60-dif_mins;
}
printf("%s : %d:%d",&(*appointmentT_ptr).description, dif_hours, dif_mins);
free(appointmentT_ptr);
free(appointmentT_ptr2);
return 0;
}
I keep getting this error at almost all occurings of appointmentT
and appointmentT_ptr
> ERROR:expected expression before ‘appointmentT"