I am trying to add two binary numbers in a c function, and I can't get the result I'm looking for.
#include <string.h>
#include <stdio.h>
char * sadd(char bn1[], char bn2[], char s[]){ //Function to add the binary numbers
        int i;
        int co = 0;
        int num = 0;
        for(i = 15; i>0; i++){
                num = (int)bn1[i] + (int)bn2[i] + co;
                co = 0;
                if(num == 2){
                        co = 1;
                        s[i] = '0';
                }
                else{
                        s[i] = (char)num;
                }
        }
        return s;
}
 
     
    