Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * bin to dec
- * converts binary string to decimal number
- * author: ipsBruno
- */
- bin2dec(n[]) {
- static c, l, j;
- c = 0;
- for(l = strlen(n) - 1, j = l ; j > -1 ; j--) {
- if(n[j] == '1') c += (1 << (l-j));
- }
- return c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement