Converting decimal number to binary in C

前端 未结 4 1780
日久生厌
日久生厌 2021-01-17 03:22

I\'m trying to convert a decimal number to binary but I somehow end up getting \'random\' ASCII symbols as an output. Here is my program:

#include 

        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-17 04:00

    You initialize i to 50 yet your binary buffer is only 10 characters in length. So you are not populating the correct elements inside the loop.

提交回复
热议问题