分享至
print() { struct Node *current = head; current = head; while(true) { printf("%d",current->num); printf("->"); current = current->next; if (current == NULL){ break; } } printf("\n"); return 0; }
上面的printf要如何改才會讓"->"少印一個,變成1->2->3這樣類似1+...+5中間只有4個加號
已邀請的邦友 {{ invite_list.length }}/5
printf("->"); current = current->next; if (current == NULL){ break; }
改成
current = current->next; if (current == NULL){ break; } else { printf("->"); }
即可
IT邦幫忙