Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Why doesn't this end

Name: Anonymous 2010-10-31 5:35

#include <stdio.h>

main()
{

    int a;

while(a != 256)
    {putchar(a);
    a++;}
}

But if I add  a = 0;  after int a;, it ends fine?

Something to do with a variable not being initialized properly, and therefore, not being able to be compared or something?

Compiled with Code::Blocks+GCC or mingw or something. The debugger also reports no relevant issues with the initial code.

Name: Anonymous 2010-10-31 7:09

>>8
>>9
>call me an idiot
>neither can explain why an unitialized variable caused the program to run on repeatedly until the system feels it's not responding
dohoho you trolled me you experts, you sure did

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List