Good morning! I'm doing a program, and in a part of it I need to create a vector full of zeros the size of the range entered by the user:
scanf("%ld %ld", &n1, &n2);
int *vetor;
vetor = malloc((n2 - n1 + 1) * sizeof(long int));
for (long int k = 0; k <= n2; k++)
{
vetor[k] = 0;
}
However, when I type some intervals, such as 100000000, the segmentation fault program is right up front, what can it be?