Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. int DeleteOdds( Node **a ) {
  2. if ( empty( *a ) ) return 0;
  3. while ( *a != NULL && (*a)->data % 2 == 1 ) *a = (*a)->next;
  4. Node *x = *a; Node *p;
  5. while ( x != NULL ) {
  6. bool flag = false;
  7. while ( x != NULL && x->data % 2 == 1 ) {
  8. Node *tmp = x;
  9. p->next = x->next;
  10. x = x->next;
  11. free( tmp );
  12. flag = true;
  13. }
  14. if ( x != NULL ) {
  15. p = x;
  16. x = x->next;
  17. }
  18. }
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement