0
Why 5th position printed as zero I expected it as 16
#include<stdio.h> int main() { char c=48; int i, mask=01; for(i=1; i<=5; i++) { printf("%c", c|mask); mask = mask<<1; } return 0; }
1 Resposta
0
Because your type specifier is %c, which means a character, the value of c will stay 48 in the fifth iteration, 48 is ASCII is 0, plus there's no character "16" in ASCII. If you want to do that, I suggest you to use an integer instead