The answer he mentioned might beby mistake he typed wrong...

Really? That's your excuse for advocating undefined behavior?

I have worked it out in over different platforms and machines and this is what i m getiing as an answer.....

You have you worked it out on every compiler and platform? Because I can prove conclusively that the C standard says it's undefined behavior and that undefined behavior may cause unpredictable results. If you need proof before admitting that programming against a standard is a good idea and ignoring the warnings of said standard is a bad idea, then I'd question your competency.

You're clearly too stubborn to see reason, so let's simply agree to disagree and let readers of the thread decide for themselves which makes more sense.

Since you won't explain in why the link I posted is in error, I must assume it's correct, therefore Narue and I are correct, any you haven't learned enough C yet to know why you are not correct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.