[ create a new paste ] login | about

Link: http://codepad.org/sggxINAq    [ raw code | output | fork ]

C, pasted on Jul 20:
#include <stdlib.h>

void print(const char *array)
{
    unsigned long long i;

    for (i = 0; i < 499999999ULL; i += 10000)
        printf("%d\n", array[i]);
}
    

void test(void)
{
    char array[499999999ULL] = {0};

    unsigned long long i;

    for (i = 0; i < 499999999ULL; i += 10000)
        array[i] = rand() % 20;

    print(array);
}

int main(void)
{
    test();
    return 0;
}


Output:
1
Segmentation fault


Create a new paste based on this one


Comments: