in reply to Passing a bytestring from Perl to Inline::C as a 2d array

2d array in C is array of pointers to 1d array. So try rewrite your cycle to something like this:
for (i=0; i<foo; i++) { for (j=0; j<bar; j++) { table[i*bar + j]++; } }