Here's a test program that I wrote. It compiles on the MinGW port of GCC 3.4.2 and on MSVC8, the program compiled returns acceptable output. My question would then be whether the pointer arithmetic is indeed correct, given that a is a two dimensional array. If it is, then the answer is still that (a)/1 is correct, because (b)/2 is wrong.
Code:
#include <iostream>
int main()
{
int a[4][3] = { {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {9, 10, 11} };
for (std::size_t i = 0; i < 4; ++i)
{
for (std::size_t j = 0; j < 3; ++j)
{
std::cout << a[i][j] << " ";
}
std::cout << "\n";
}
std::cout << "\n";
for (std::size_t i = 0; i < 4; ++i)
{
for (std::size_t j = 0; j < 3; ++j)
{
std::cout << *(&a[0][0] + (3 * i) + j) << " ";
}
std::cout << "\n";
}
}