Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Program 1
- #include <stdio.h>
- #define MAX_CNT 100
- int main(int argc, char** argv)
- {
- int i, j, k;
- int test_data[MAX_CNT][MAX_CNT][MAX_CNT];
- for(i = 0; i < MAX_CNT; i++)
- {
- for(j = 0; j < MAX_CNT; j++)
- {
- for(k = 0; k < MAX_CNT; k++)
- {
- test_data[i][j][k] = 100;
- }
- }
- }
- return 0;
- }
- Result
- $ time ./main
- real 0m0.008s
- user 0m0.004s
- sys 0m0.004s
- -- Program 2
- #include <stdio.h>
- #define MAX_CNT 100
- int main(int argc, char** argv)
- {
- int i, j, k;
- int test_data[MAX_CNT][MAX_CNT][MAX_CNT];
- for(i = 0; i < MAX_CNT; i++)
- {
- for(j = 0; j < MAX_CNT; j++)
- {
- for(k = 0; k < MAX_CNT; k++)
- {
- test_data[k][j][i] = 100;
- }
- }
- }
- return 0;
- }
- $ time ./main
- real 0m0.017s
- user 0m0.013s
- sys 0m0.004s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement