int main()
{
unsigned int i=65000;
while ( i++ != 0 );
printf("%d",i);
return 0;
}
The output for this program is 1 can anyone explain me how I got this output?
Thanks in advance.
Looks simple. You used a post increment.
http://www.quora.com/What-is-the-difference-between-pre-increment-and-post-increment-operator-in-C++
So you get i for evaluation and later it's incremented so the i for evaluation is zero but as it's a post increment, it exits with i as 1.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.