Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Przerob(struct tnode** head){
- if(!*head){
- printf("Lista jest pusta!");
- return;
- }
- struct tnode* curElement = *head;
- struct tnode* nextElement = (*head)->next;
- while(nextElement != NULL){
- if(nextElement->value < 0){
- curElement->next = nextElement->next;
- free(nextElement);
- nextElement = curElement->next;
- } else {
- curElement = curElement->next;
- nextElement = curElement->next;
- }
- }
- if((*head)->value < 0){
- curElement = (*head)->next;
- free(*head);
- *head = curElement;
- }
- curElement->next = *head;
- printf("\n");
- curElement = *head;
- do{
- printf("%d ",curElement->value);
- curElement = curElement->next;
- }while(curElement != *head);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement