That printf statement isn't doing what you think it is, it's just printing space characters. You'll probably want to do printf(" %d\n", x); instead. If you enabled all the optional warnings in your compiler, you would likely get a warning that you passed too many arguments (ie, x and "\n" being ignored because the format string didn't call for the use of any additional arguments).