Correct way of passing 2 dimensional array into a function

You should declare your function like this:

void display(int p[][numCols])

This C FAQ thoroughly explains why. The gist of it is that arrays decay into pointers once, it doesn’t happen recursively. An array of arrays decays into a pointer to an array, not into a pointer to a pointer.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)