1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Reading bit and converting to string

Discussion in 'C' started by Jams, Apr 9, 2010.

  1. Jams

    Jams New Member

    I just learned bitshifts and I was wondering whether it is possible to read bits and to convert them into a string.

  2. xpi0t0s

    xpi0t0s Mentor

    Yes it is.
  3. Jams

    Jams New Member

    How would someone go about doing it?
  4. Player

    Player New Member

    This takes 12 in dec, 2 is the base to be used (binary) and is then stored in the str array.

    int main(void)
        char str[4];
        printf("12 to binary is %s\n",itoa(12,str,2));
    Last edited by a moderator: Apr 16, 2010

Share This Page