I feel a little stupid posting this, but on a lot of forums / sites and what not I've seen it's not possible to get the size of a newed array. So I kept on reading a few forums the other night and saw no one had an answer to get the size for a newed int, double, float and long array etc.
Reason I feel stupid posting this is - are they right in you cannot obtain the size of those arrays? Anyway I whipped together a small program that was able to grab the size of these. And from what I can tell it returns the correct size. But it's probably easy for this to break, crash and burn as well.
To be honest with you I dont see a problem with the code or the logic behind it. I think it is more of an issue of good practice to explicitly know the size( i think). Other than that though I dont see this code getting broken.
What gets me though is line 8 and 9
what exactly does that do. with the "!" operator
i would figure that would force it passed the bounds, but what does a statement like that return.
If im not mistaken for the loops to work it has to get a value of true and when the statement is false it fails the test. I wonder if it is because what you set the array too in main??? Because is 1== true and 0 == false ?? This might be the case though. You see what im saying??
lol cool. I dont know how the hell i figured it out but owell. is that how it works though?? If you change the initialization of the array to some other number it wont work?? Thats crazy if it doesnt
edit: the funny thing is that you just happend to initialize all of your arrays to 0 and it worked