Advertisement
Guest User

Untitled

a guest
Jun 29th, 2015
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. -- Program 1
  2. #include <stdio.h>
  3.  
  4. #define MAX_CNT 100
  5.  
  6. int main(int argc, char** argv)
  7. {
  8. int i, j, k;
  9. int test_data[MAX_CNT][MAX_CNT][MAX_CNT];
  10.  
  11. for(i = 0; i < MAX_CNT; i++)
  12. {
  13. for(j = 0; j < MAX_CNT; j++)
  14. {
  15. for(k = 0; k < MAX_CNT; k++)
  16. {
  17. test_data[i][j][k] = 100;
  18. }
  19. }
  20. }
  21.  
  22. return 0;
  23. }
  24.  
  25. Result
  26. $ time ./main
  27.  
  28. real 0m0.008s
  29. user 0m0.004s
  30. sys 0m0.004s
  31.  
  32.  
  33. -- Program 2
  34. #include <stdio.h>
  35.  
  36. #define MAX_CNT 100
  37.  
  38.  
  39. int main(int argc, char** argv)
  40. {
  41. int i, j, k;
  42. int test_data[MAX_CNT][MAX_CNT][MAX_CNT];
  43.  
  44. for(i = 0; i < MAX_CNT; i++)
  45. {
  46. for(j = 0; j < MAX_CNT; j++)
  47. {
  48. for(k = 0; k < MAX_CNT; k++)
  49. {
  50. test_data[k][j][i] = 100;
  51. }
  52. }
  53. }
  54.  
  55. return 0;
  56. }
  57.  
  58. $ time ./main
  59.  
  60. real 0m0.017s
  61. user 0m0.013s
  62. sys 0m0.004s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement