Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting address of an array to other data types

Tags:

int main()
{
    char arr[5][7][6];
    char (*p)[5][7][6] = &arr;
    printf("%d\n", (&arr + 1) - &arr);
    printf("%d\n", (char *)(&arr + 1) - (char *)&arr);
    printf("%d\n", (unsigned)(arr + 1) - (unsigned)arr);
    printf("%d\n", (unsigned)(p + 1) - (unsigned)p);

    return 0;
}

When I run the above code I get following output:

 1
 210 
 42
 210

Why is the output not 1 in every case?