how would one manipulate the code below, using pointers?
int add(int a, int b)
{
int result=0;
int s=0, c=0; /* result and carry; carry in for bit 0 is 0 */
/*int bit_a, bit_b;
int i, n, mag=0;
for(i=0; i<16; i++) {
bit_a = ((mask_array[i] & a)?1:0);
bit_b = ((mask_array[i] & b)?1:0);
printf("bitA%d: %d bitB%d: %d\n",i,bit_a,i,bit_b);
s = gate8(gate0(bit_a,bit_b,c),gate3(bit_a,bit_b,c),
gate5(bit_a,bit_b,c),gate6(bit_a,bit_b,c));
c = gate9(gate0(bit_a,bit_b,c),gate1(bit_a,bit_b,c),
gate2(bit_a,bit_b,c),gate4(bit_a,bit_b,c)); /* carry bit forward to next loop */
/* printf("sum: %d carry: %d\n",s,c);
if (i==0) mag = 1;
else {
mag = 1;
for (n=0; n<i; n++) mag = mag * 2;
}
if (s > 0) result = result + mag;
}
return result;
}