Advertisement
iamakulov

Untitled

Mar 23rd, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. void task3()
  2. {
  3.     int k, count = 0;
  4.     struct Stack *beforeLast = NULL;
  5.     scanf("%d", &k);
  6.  
  7.     run = L;
  8.     while (run->next != NULL) {
  9.         if (run->next->inf == k) {
  10.             ++count;
  11.             beforeLast = run;
  12.         }
  13.         run = run->next;
  14.     }
  15.  
  16.     if (count > 0) {
  17.         run = beforeLast->next;
  18.         beforeLast->next = beforeLast->next->next;
  19.         free(run);
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement