according to me following while loop should be infinite but it runs only thrice
main()
{
int i=3;
while(i--)
{
int i=100;
The variable i in while(i--) is different from the variable i defined inside the loop.
Basically int i = 100 shadows the previous int i = 3 and inside the block of the while you're referring to a new variable.
At the end of the day, I find no plausible scenario where you would need to do something like this.