Question: Write a program in C that converts a binary string to decimal. This is what I have now but it is not working Convert a

Write a program in C that converts a binary string to decimal.

This is what I have now but it is not working

Write a program in C that converts a binary string to decimal.

Convert a binary number to an unsigned integer Unexpected characters are ignored. Only 1's and 0' s are considered to be valid. a10c1 should convert to 5 Oparam binary Binary number as a string of 1 s and '0's. Creturns unsigned in t result unsigned int bin2dec (const char *binary) int bin while (*binary 'le'){ if( *binary 48) bin+ if( *binary 49) bin+ 1; binary++ printf ("bintis %d bin unsigned int res; int rem; int po while bin 0) rem bin 9610 bin 10; res rem*pow pow* 2; return res

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!