Hello, newbie here.

Just started euler problems to get better acquainted with C. The first problem is this-

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

So here is my program-

Code:

#include <stdio.h>
int main()
{
int _MAX = 1000;
int nums[_MAX] = {0};
int checkers[] = {3,5};
int k = 0;
int len = sizeof(checkers)/sizeof(int);
int sum = 0;
int checker;
for(k = 0; k < len; k++)
{
checker = checkers[k];
sum = 0;
while(sum+checker <= _MAX)
{
sum += checker;
nums[sum] = 1;
}
}
sum = 0;
for(k = 0; k < _MAX; k++)
{
if(nums[k])
sum += k;
}
printf("%d", sum);
getchar();
return 0;
}

This compiles with an error-

main.c(6): error C2057: expected constant expression

main.c(6): error C2466: cannot allocate an array of constant size 0

which is line

Code:

int nums[_MAX] = {0};

If I change _MAX here to 1000 everything works and I get the right answer. What is wrong and how do I fix this? I tried google but got more confused.