Quote:
Originally Posted by
raihan004
but without declaring arry its work on windows how and why?
By complete coincidence, nothing more. If this was a debug build, a release build might crash, or vice versa. You are using undefined behavior -- undefined doesn't mean "will crash", undefined means "unpredictable".
Windows will let you get away with very stupid things -- temporarily. It allowed me to delete my
video surface sixty times per second and not crash then and there. It still crashed, but far later, in mysterious ways which took days to debug, because not crashing immediately meant I had no clue where the bug was.
Using undefined memory means you're wrecking something, somewhere. You might be overwriting your stack pointer, wrecking your ability to make function calls. You might be overwriting something in heap space, ruining heap pointers and causing weird malloc() crashes later. You might be in data space and overwriting your global variables. This is not safe, stable, or sane. Memory does not work that way. Use a buffer.