skpro19's blog

By skpro19, history, 5 years ago, In English

I observed a weird thing today in the Visual Studio IDE while solving the second question of Hourrank 25. This the the code.

On my local machine, the value of pre[0][0], automatically becomes 1 randomly anywhere inside the while loop. However, the weird thing is, if I initialise the value of fact[0] to 0, then everything becomes normal again. This is weird because the computation of fact has nothing to do with the value of pre[0][0].

I feel silly asking this, but what am I missing? The code which is giving wrong answer on the local machine , gives the correct answer on Ideone, and also fetches full marks after submission.

Can someone please help.

Thanks. Peace.

  • Vote: I like it
  • 0
  • Vote: I do not like it