0

I'm declaring an array of uint8_t with 10 milion elements. It should fit in memory and under all indexing limits. I'm compiling using g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 via Geany.

#include<cstdio>
#include<stdint.h>
using namespace std;

int main() {
    uint8_t in[10000000];
    printf("%li", sizeof(in));
}
Chumanista
  • 102
  • 12
  • 2
    1) It's not C. 2) You have a stack overflow. 3) You don't have a `return` statement. – Eugene Sh. Oct 14 '15 at 18:54
  • There's a limit on the size of local variables in a function, you're going beyond it. – Barmar Oct 14 '15 at 18:55
  • 1
    To state the maybe obvious: local variables are allocated on the stack. Perfect fit to the name of this site ... –  Oct 14 '15 at 18:57

0 Answers0