Is this program logically correct or just dumb luck ? ... That is where I made some random changes and this code worked !
If you just made "random changes" to your code, then there was no logic applied on your part. So I would have to call it dumb luck. Do you understand why this works now where as, ostensibly, it did not before?
Is there a link or something related to this topic ?
Yes, it's one of his older submissions which is why it doesn't show up in the 'Articles' section, but Disch does an excellent job of explaining why you're probably having trouble wrapping your head around this, here: http://www.cplusplus.com/forum/articles/17108/
EDIT: I should note that the opinion he conveys in this article isn't what you should pay attention to. In fact I don't really agree with it. But the technical content behind it is laid out well and that is what you should gain an insight on by reading this.