この機能に問題があります。私がそれを呼び出すと、クライアントは最後 (尾) から最初 (頭) に印刷されます。
問題は、最初(頭)から最後(尾)まで印刷したいということです。私が試したことはすべて、セグメンテーション違反が発生するか、最初のクライアントのみを出力します。
プログラムは銀行に関するものであることに注意してください。順番に印刷したい顧客の列があります。
前もって感謝します!
void printAll(clientData* tail) {
clientData *current;
current = tail;
if (current == NULL) {
printf("There is no client in queue\n");
return ;
}
while (current != NULL) {
printf("%s %s %d/%d/%d %s %s %s %s\n",
current->firstname,
current->lastname,
current->birthday.day,
current->birthday.month,
current->birthday.year,
current->bankaccount,
current->telephone,
current->email,
current->bankcommand);
current = current->next;
}
return;
}