The_Law

Untitled

Dec 1st, 2017
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. //zadacha3
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5.  
  6. struct list {
  7.     int x;
  8.     struct list * next;
  9. };
  10.  
  11. void tofront(struct list **p1) {
  12.     int n = 1;
  13.     struct list *we = *p1;
  14.     while (we -> next)
  15.         we = we->next, ++n;
  16.     for (int i = 0; i < n / 3; ++i) {
  17.         we -> next = *p1;
  18.         we = we -> next;
  19.         *p1 = (*p1) -> next;
  20.     }
  21.     we -> next = NULL;
  22. }
  23.  
  24. void print(struct list *t) {
  25.     while (t) {
  26.         printf("%d -> ", t->x);
  27.         t = t -> next;
  28.     }
  29. }
  30.  
  31. int main(void) {
  32.     int x, y;
  33.     printf("%d", (x = 4, y = 5));
  34.     return 0;
  35. }
Add Comment
Please, Sign In to add comment