Q:

Simple C function returns nonsense

I need to make simple function that converts binary number (string) to decimal number (long). When it returns result, it's nonsense. I've tried to return all others variables and it returned correct numbers. There is something wrong with my result variable.
#include "stdio.h"
#include "string.h"
#include "math.h"

long bintodec(const char *bin_num) {
        long DIGIT, SUBTOTAL, RESULT = 0, I, LEN;
        LEN = strlen(bin_num);
        for(I = 0; I != LEN; I++) {
                sscanf(&bin_num[I], "%li", &DIGIT);
                SUBTOTAL = DIGIT * pow(2, LEN - I - 1);
                RESULT = RESULT + SUBTOTAL;
        }
        return RESULT;
}

main() {
        clrscr();
        printf("%li", bintodec("101"));
        getch();
}

A:

sscanf is expecting a C string:

During the first iteration it receives "101" and 101 * 4 is 404
During the second iteration it receives 01 and 1 * 2 is 2
During the third iteration it receives 1 and 1 * 1 is 1
404 + 2 + 1 is 407 which must be the nonsense you are seeing

What you want is to convert each character:
DIGIT = bin_num[I] - '0';

