The essence of the question is as follows. It is necessary to add structure to the list. But an error pops up: void push(avia *,int,char *,char *) : it is not possible to convert argument 1 from avia ** to avia * . I do not understand what's wrong.
Here is the case:
if (uslovie == true) { int number; char destination[10]; char time[10]; printf("Vvedite nomer: "); scanf_s("%d", &number); printf("\n"); printf("Vvedite punkt: "); gets_s(destination); printf("\n"); printf("Vvedite vremya: "); gets_s(time); printf("\n"); system("cls"); push(&head, number, destination, time); printf("Element uspeshno dobavlen!\n"); system("pause"); break; } else printf("Sozdaite spisok!\n"); system("pause"); break; But the called function:
void push(avia **head, int number, char *destination, char *time) { avia *tmp = (avia*)malloc(sizeof(avia)); if (*head == NULL) { tmp->number = number; for (int i = 0; i < 10; i++) tmp->destination[i] = destination[i]; for (int i = 0; i < 10; i++) tmp->time[i] = time[i]; tmp->next = NULL; *head = tmp; } else { tmp->number = number; for (int i = 0; i < 10; i++) tmp->destination[i] = destination[i]; for (int i = 0; i < 10; i++) tmp->time[i] = time[i]; tmp->next = *head; *head = tmp; } }
get_sfunctionget_stwo parameters, not one. And this error will be reported by the compiler before thepushcall. The same error that you cited cannot be explained by the code given so far. - AnT