1: int a[1000];
2:
3: main()
4: {
5: int asize = 1000,i,inc = 0,new;
6:
7: srand(1);
8: for (i = 0 ; i < asize ; i++)
9: a[i] = i;
10: while (1) {
11: new = rand() % 4000;
12: if (((rand() % 1000) > 750) && ((asize - new) > 1000))
13: new = -new;
14: for (i = 0 ; i < asize ; i++ )
15: if (a[i] != i)
16: printf("bad a %x\n",i);
17: if (sbrk(4 * new) != -1) {
18: if (new > 0) {
19: for (i = 0 ; i < new ; i++)
20: a[asize + i] = asize + i; }
21: asize += new; }
22: else {
23: new = 1000 - asize;
24: sbrk(4 * new);
25: asize += new; }
26: sleep((rand() % 4) + 1); }
27: }
Defined functions
main
defined in line
3;
never used
Defined variables
a
defined in line
1; used 3 times