Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void addNode(Node ** head, Kola temp, int *cnt)
- {
- FILE *fp;
- fp = fopen("file.txt" , "a");
- Node* newNode = (Node*)malloc(sizeof(Node));
- newNode->data = temp;
- newNode->next = NULL;
- Node* temp2 = *head;
- // Ako nqma pyrvi element v spisyka => spisyka e prazen => dobawqme nova kola v nachaloto
- if(!(*head))
- {
- *head = newNode;
- (*cnt)++;
- fprintf("%s %s %s %d %2.2f", temp.kod, temp.marka, temp.cvqt, temp.obemDvigatel, temp.cena);
- printf("Avtomobilat beshe dobaven uspeshno.\n");
- return;
- }
- while(temp2->next)
- {
- temp2 = temp2->next;
- }
- temp2->next = newNode;
- (*cnt)++;
- fprintf("%s %s %s %d %2.2f", temp.kod, temp.marka, temp.cvqt, temp.obemDvigatel, temp.cena);
- printf("Avtomobilat beshe dobaven uspeshno.\n");
- fclose(fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement