Getting wrong output
<p>This is the code: 
A[0] (in the main function) should be equal to 0, not 1. I can't find my mistake. I suppose the problem is somewhere in the and1 function, but again, I can't seem to be able to find it. Anyway I am pretty sure that the first sentence covered the problem pretty well, but the website is forcing me to write more information.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
// V and ^ or
using namespace std;
int A[] = {0, 1, 1};
int B[] = {1, 0, 1};

 int* and1(int A[], int B[])
{
    int ret[3];
    for(int i = 0; i &lt; 3; i++)
    {
        if(A[i] == 1 &amp;&amp; B[i] == 1 )
        {
            ret[i] = 1;
        }
        else
        {
            ret[i] = 0;
        }
    }
    return ret;
}

int* or1(const int A[], const int B[])
{
    int ret[] = {0 ,0 ,0};
    for(int i = 0; i &lt; 3; i++)
    {
        if(A[i] == 1 || B[i] == 1)
        {
            ret[i] = 1;
        }
        else
        {
            ret[i] = 0;
        }
    }
    return ret;
}

int main()
{
    int* a = and1(A, B);
    int* b = or1(A, B);
    if(*(a+1) == *(b+1))
    {
        cout &lt;&lt; a[0] &lt;&lt; endl;
    }
    return 0;
}
</code></pre>
