There is no such thing as int buf in C. In a C99 compiler, there are variable length arrays (VLAs), but Microsft compilers don't support this. If you're using Visual Studio, you can't use them.
Normal array arguments only allow the first dimension to be unknown. So int buf is okay.
If you need both dimensions to be variable, the most portable choice is to follow Bill's suggestion, passing a pointer to buf and the actual dimensions of the array.
int get_item(int *buf, int nrows, int ncols, int i, int j) /* get buf[i][j] */
.... assert (i>=0 && j>=0 && i < nrows && j < ncols);
.... return *(buf + i*ncols + j);
The assert() macro is defined in <assert.h> and will generate no code in your release build if you add a #define for the symbol NDEBUG. On debug builds, you probably want an error message if an index is out of bounds.