Question: I'm porting some C++ code to Actionscript 3 and just had a small question I'm confused about.

In one function, one of the parameters is `int* myPtr`. myPtr is the address of an element of a 2D-Array, `&my2DArray[x][y]`. x and y are also parameters of the function. I'm just a little bit confused with what is being accessed when the code accesses, for example, `myPtr[1]`. I think this would be the next element in `my2dArray`, but I'm not sure if this would be `my2DArray[x+1][y]` or `my2DArray[x][y+1]`. Thanks for any help.

Additional info:
my2DArray is created by: 

```
//initPtr is a int*, auxPtr is a int*, as is temp1
initPtr = (unsigned int *)NewPtr(
      sizeof(unsigned int) *
      X * Y);
  }

  auxPtr = initPtr ;

  for (i = 0; i < X; i++) {
    temp1 = auxPtr + i * Y;
    my2DArray[i] = (short *)temp1;
  } 

unsigned char* NewPtr(
  int size)
{
  return ((unsigned char*)calloc(size, sizeof(unsigned char)));
}

```

Answer: 
The original solution by Martijn will not work for large binary numbers. The below code can be used to overcome that.

```
public String addBinary(String s1, String s2) {
    StringBuilder sb = new StringBuilder();
    int i = s1.length() - 1, j = s2.length() -1, carry = 0;
    while (i >= 0 || j >= 0) {
        int sum = carry;
        if (j >= 0) sum += s2.charAt(j--) - '0';
        if (i >= 0) sum += s1.charAt(i--) - '0';
        sb.append(sum % 2);
        carry = sum / 2;
    }
    if (carry != 0) sb.append(carry);
    return sb.reverse().toString();
}

```
```
import java.util.*;
public class BitAddition {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        int len = sc.nextInt();
        int[] arr1 = new int[len];
        int[] arr2 = new int[len];
        int[] sum = new int[len+1];
        Arrays.fill(sum, 0);
        for(int i=0;i<len;i++){
            arr1[i] =sc.nextInt();
        }
        for(int i=0;i<len;i++){
            arr2[i] =sc.nextInt();
        }
        for(int i=len-1;i>=0;i--){
            if(sum[i+1] == 0){
                if(arr1[i]!=arr2[i]){
                    sum[i+1] = 1;
                }
                else if(arr1[i] ==1 && arr2[i] == 1){
                    sum[i+1] =0 ;
                    sum[i] = 1;
                }
            }
            else{
                if((arr1[i]!=arr2[i])){
                    sum[i+1] = 0;
                    sum[i] = 1;
                }
                else if(arr1[i] == 1){
                    sum[i+1] = 1;
                    sum[i] = 1;
                }
            }
        }
        for(int i=0;i<=len;i++){

        System.out.print(sum[i]);
        }
    }

}

```