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

Автор SEFI2, 10 лет назад, По-английски

Hello everyone! Yesterday i was upset when my program failed 19test. I didnt have any ideas why it failed.. so i decided to resend my program once again.... ACCEPTED . See my code ( 1 , 2 )

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

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

My experience: if you declare a C-style array (like x) inside a function, it gets located on your program's stack, however it may not be (and usually isn't) cleaned up. It means you've get an array with some possibly random characters. If you're lucky enough, you'll pass. If not, your program will meet an o on the border of the board and possibly change the result.

Examples: http://ideone.com/CcNtNz — declared inside a function (on the program-specific stack); some garbage inside, you should clean it up.

http://ideone.com/LHg3d5 — outside a function (on the heap); it gets initialized = zeroed.