I have tried playing with some Project Euler problem (decided to do it in C), but was stopped in the beginning by the rather strange Segmentation Fault:
Code:
#include <stdio.h>
main()
{
unsigned long int searched_prime, max, i, j;
max = 1000000000L;
unsigned long int nums[max];
printf("%s", "success");
}
Can you please help me debug why this prints Segmentation Fault? Is there an error with the declarations? I have ran Valgrind on it, ran it through gdb, but wasn't able to find my error. I have tried compiling it with:
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
Bookmarks