I am trying to convert a decimal to binary such as 192 to 11000000. I just need some simple code to do this but the code I have so far doesn't work:
void dectobin(int value, char* output)
output = '\0';
for (i = 4; i >= 0; --i, value >>= 1)
output[i] = (value & 1) + '0';
Any help would be much appreciated!
以上就是Convert decimal to binary in C的详细内容，更多请关注web前端其它相关文章！