Блог пользователя Dontony

Автор Dontony, история, 4 года назад, По-английски

Can we create an array of size 1e6+1 in C++(in my IDE the code crashes),by any methods,or, using vectors would be better? Please comment on this!Thanks.

  • Проголосовать: нравится
  • -12
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

I think you should cast it as an integer like (int)(1e6+1). Probably post code for better help :)

»
4 года назад, # |
Rev. 2   Проголосовать: нравится +4 Проголосовать: не нравится

Declare the array in the global. It's because when you declare variables inside a function, its limited to the stack size. And I think your IDE set the stack size smaller.