I have this piece of code and I run this on windows (vc++) and in Ubuntu (g++ 4.4). In Linux it works fine and works without any error (neither at compile time nor at runtime), but on windows it crashes with error "Variable used without initializing" at runtime. Any comments on the behavior? Is it because of the difference in OS?
...on windows it crashes with error "Variable used without initializing" at runtime. Any comments on the behavior
Windows is doing the correct thing, Linux is letting you get away with dodgy code.
I'm assuming that you are trying to make a DeleteTest[5][5]. Your DeleteTest **doubleArray; has to point to an array of pointers to DeleteTest *, so you need to new an array of such a type.
Thanks for that. That is what I am trying to achieve. Can you explain a little as to what you're trying to do with line 25? And why is g++ taking care of this internally? Well, I get a warning saying 'doubleArray' is being used without initialization and that's it.
A DeleteTest ** is a pointer to a DeleteTest *, as you are doing a 2d array (an array of arrays), doubleArray has to point to an array of DeleteTest *s, that is what line 25 is doing.