source:
proiecte/Parallel-DT/R8/Src/test.c
@
71
Last change on this file since 71 was 71, checked in by , 14 years ago | |
---|---|
File size: 356 bytes |
Rev | Line | |
---|---|---|
[71] | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | |
3 | ||
4 | int main(){ | |
5 | char* x = NULL; | |
6 | unsigned long size = 1024; | |
7 | ||
8 | x = malloc(10); | |
9 | printf("long = %d\n", sizeof(unsigned long)); | |
10 | ||
11 | while(1){ | |
12 | x = realloc(x, size); | |
13 | ||
14 | if(x == NULL){ | |
15 | printf("size = %lu\n", size); | |
16 | ||
17 | fflush(stdout); | |
18 | break; | |
19 | } | |
20 | else{ | |
21 | x[size - 1] = 'a'; | |
22 | } | |
23 | size *= 2; | |
24 | } | |
25 | ||
26 | return 0; | |
27 | } |
Note: See TracBrowser
for help on using the repository browser.