-1
I’m studying the data types of the C language. And today I decided to create a vector of very large size, in this case, 10 8. So, I made a small code in which I declare this large vector (being that the value 10 8 fits the type Int), fill its positions and try to access a certain element of it. However, the program is not running properly, nothing happens, although no build error is being displayed. Could you tell me the correct way to create such a large vector? Thanks in advance!
#include <stdio.h>
int main() {
int vet[100000000], i;
for (i = 0; i < 100000000; i++)
vet[i] = i;
printf("%d", vet[200]);
return 0;
}
Here https://ideone.com/8qyNex has run correctly. But it will depend on your environment and available memory.
– anonimo
Complementing: take a studied stack and heap to understand the memory allocation and why when using dynamic allocation can escape the stack overflow.
– anonimo