I am trying to set index for the for loop to go over a char array.
For some reason when I go to debug mode I see the variable i (I use it as index in the for loop) initialized to 0
and the step is i++ instead of i--.
Using ddd debugger on ubuntu.

As mentioned in the top comments, there are a number of issues ...
for (i = num_bits; i >= 1; i--)intofor (i = num_bits - 1; i >= 1; i--)aandbvectors use ascii values (e.g.'0'-'1') instead of binary (e.g.0x00-0x01). And, thesumvector uses binary. These should match.pow(2*Bin_Rep_sum[i],i)is wrong. Do you want:Bin_Rep_sum[i] * pow(2,i)??? Actually, this is still wrongBecause the code was posted as an image, and was missing some key elements, I had to completely restructure the code. It corrects all of the aforementioned issues:
Here is the test program output: