This code doesn't really make sense... Why initialize the array with a non-zero size if you're going to push values anyways? Also, you can't really compare an array with a number. That's sure to give you a type mismatch. Maybe you meant to use a value inside the array? ( A[1]==2 )