I want to have a number filled with 1's and 0's and convert it to boolean. However, when I run my code, it print's out all 1's. My code
I have almost all of the code finished, i know i'm just missing a piece possibly.
unsigned int booltoint(char number[], int length)
{
int i;
bool check;
for(i = 0; i < length; i++)
{
if(number[i] == 0)
{
check = false;
printf("%d\n", check);
}
else
{
check = true;
printf("%d\n", check);
}
}
return check;
}
int main()
{
int length;
char number[] = "11001100";
length = strlen(number);
booltoint(number, length);
}