Please find the code snippet shown below:
unsigned char au8Buffer[4] = {1, 2 , 3, 4} ;//Global array declared
class abc
{
    public:
    unsigned char *Getheader();
}
void func(abc *ptr)
{
    unsigned int a, b;
    a = (ptr->Getheader())[0];
    b = (ptr->Getheader())[1];
    printf("the value of A = %d\n",a);
    printf("the value of B = %d\n",b);
}
unsigned char * abc:: Getheader(void)
{
    static int count  = 0;
    count++;
    if(1 == count)
        return &au8Buffer[0];
    else
        return &au8Buffer[1];
}
main()
{
    abc Testobj;
    func(&Testobj);
}
Can someone please tell me why is the value of the variable 'b' coming as 3?. I was expecting the value of b to be 2.
 
    