Ah, but this is C99 or C++.
Here should be C89 compatible code:
Don't forget to include stdio.h.Code:#define bitmask(i) (1U << i) int main(void) { /* The number of bits in an int */ const int intSize = 31; /* The decimal number to convert */ int value; int i; char bit = '0'; printf("Please enter a decimal number to be converted: "); scanf("%d", &value); /* Print the bits of the decimal value */ for (i = intSize; i >= 0; --i) { /* Assume bitmask(i) is unset */ bit = '0'; /* Pick the character to print */ if (value & bitmask(i)) { bit = '1'; } putchar(bit); } putchar('\n'); }