aboutsummaryrefslogtreecommitdiff
path: root/semestr-4/ask/lista8/swap.c
blob: e1966fd39d3d98b9ed8b603ce7c11d54235c8338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
extern int buf[];

int *bufp0 = &buf[0];
static int *bufp1;

static void incr() {
  static int count = 0;
  count++;
}

void swap() {
  int temp;
  incr();
  bufp1 = &buf[1];
  temp = *bufp0;
  *bufp0 = *bufp1;
  *bufp1 = temp;
}