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:27

>>12
>implying if I use printf("%d", a) it makes a difference
>If that doesn't explain it
There is no explicit reason why it doesn't work. You're retarded.

If it's implicit that variables are initialized to -max, then that is a convention of the language.

Name: Anonymous 2010-10-31 7:30

>>12

>implying int and char aren't the exact same fucking thing in C, other than their sizes.

OP is stupid as fuck, but this is not why.

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