1. ## integer to binary

so i got a character input from the user, converted it into an integer, and have that integer stored in m.

now im trying to convert that integer into binary...heres the code im using to do that:

Code:
```while(m>=1)
{
testing[x] = m &#37; 2;
x++;
}

for(i = x; i<=0 ; i--)
printf("%d", testing[i]);```
---

as you probably can tell im a beginner so if this code looks primative, well you know why.

the problem is that its not working lol, basically it just stops doing anything after the user enters the character (and it also prints the integer value on screen after that so i know that parts right)

anyway do I have the right idea here, if so why isnt it working? thanks.

EDIT: by the way, i intialized the testing array as an int with size 5. i dunno what size i should set it to..

2. is m getting any closer to 1 round your loop?

3. You can use binary operators.
Code:
```    int val = 64;

int i;
for(i = 7; i >= 0; --i)
printf("&#37;d", (val & (1 << i)) > 0);```
This will print 8 bits of the value. If you want to print all 32 bits of the integer then change i = 7 to i = 31 (since the condition allows 0, "i" needs to be 32 - 1)

EDIT: Also the reason why yours freezes is because the "while" loops condition requires m to be >= 1 but m is never changed in the loop, so it will always pass the condition if it's >= 1.