blob: decb3fff4112bd44a750a9e85a740da27adb7734 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "stdio.h"
#include "stdlib.h"
int main(void) {
int N = 10000, M=100000;
float **x = malloc(N*sizeof(float*));
float *y = malloc(M*sizeof(float*));
int i,j;
for (i = 0; i < N; i++) {
x[i] = malloc(M*sizeof(float));
for (j = 0; j < M; j++) {
x[i][j] = (float) j;
}
}
for (i = 0; i < N ; i++) {
for (j = 0; j < M; j++) {
y[i] += x[i][j];
}
}
printf("%f\n", y[100]);
free(x); free(y);
return 0;
}
|