#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;
}
я получаю эту ошибку при почти всех occurings из appointmentT
и appointmentT_ptr
указателей на структуры с таНос-выражением ожидался ошибка C
> ERROR:expected expression before ‘appointmentT"
Это сработало сейчас, спасибо – Chrisa4
@ Chrisa4, если вам нравится ответ, вы должны принять его, чтобы вопрос появился как ответ в фиде вопроса. Кроме того, вы даете человеку, который помог вам что-то взамен, что приятно. Я бы посоветовал вам взглянуть на мой ответ, так как ваш код имеет больше ошибок. – gsamaras
@ G.Samaras Извини, что ты прав> Im новый здесь, и я не знал, как это работает – Chrisa4