CodePudding user response:
The main start, since is a string, so should be defined as a char STR [80]. The parameter should be also char [] p; P [I] - '0'CodePudding user response:
To join https://bbs.csdn.net/topics/399167039CodePudding user response:
Zhao four old wet are on the way to, but he doesn't want to answer this simple question, so I replace him to answer:# include & lt; String. H>
Int BinToDec (char []) p
{
If (strlen (p)==0) return 0;
Return * p - '0' & lt;}
We have adopted a recursive method, according to the order of each 0, 1 to move it to specify the location of a binary number, after finishing move is the final result,