Well no, because you could not have declared your array at run-time with a variable size.
Using a C99 compiler, you can do this.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void foo ( int size, int arr[size][size] ) {
for ( int i = 0 ; i < size ; i++ ) {
printf("%d\n",arr[i][i]);
}
}
int main ( ) {
int size = 3;
int arr[size][size];
arr[0][0] = 0;
arr[1][1] = 1;
arr[2][2] = 2;
foo(size,arr);
return 0;
}
Unless you can guarantee that size will be small, you're better off using malloc to allocate the space. A VLA can blow your stack allocation with zero warning, and no recovery.