fix ex1 code style
[sws1-1415.git] / ass4 / mart / sws1-assignment4-s4109503-s4202015 / exercise1.c
1 #include <stdlib.h>
2 #include <stdio.h>
3
4 int main(void)
5 {
6 size_t s = 0;
7 char *buf;
8 char dir = 1;
9 for(size_t i = 1 << 31; i >= 1; i /= 2, free(buf))
10 dir = (buf = malloc(s += dir * i)) == NULL ? -1 : 1;
11 printf("One malloc can allocate at most %zu bytes\n", s);
12 return 0;
13 }