All pastes #838857 Raw Edit

Anonymous

public text v1 · immutable
#838857 ·published 2007-12-30 18:37 UTC
rendered paste body
#include <conio.h>
#include <time.h>
#include <stdlib.h>

#define SIZE 100000
#define REPEAT 1000

#define TEST(x) s = clock(); for(int j = 0; j < REPEAT; j++) for(int i = 0; i < SIZE; i++) x[i] = x[0]+x[SIZE-1]+x[i/2]; e = clock(); printf("Time: %f\n", (float)(e-s) / (float)CLK_TCK);

int *a;
int b[SIZE+1];

void main (void)
{
    a = new int[SIZE+1];
    int *c = new int[SIZE+1];
    int d[SIZE+1];

    clock_t s,e;
    TEST(a);
    TEST(b);
    TEST(c);
    TEST(d);
    getch();
}