int n = 10;
char *s;
while (n > 0) {
s[strlen(s)] = n % 2 + 48;
n = n / 2;
}
printf("%s", s);
I tried to convert a series of 0's and 1's into string but, I didn't get the output as expected, eventhough, this logic is correct. What goes wrong here?