Here're the functions to be able to accept varying numbers of dimension lengths.

Code:

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
/* function prototypes */
void GetData( int* num_ptr, int numrows, int numcols );
double sumsquares( int* num_ptr, int numrows, int numcols );
int main( void )
{
int num[3][4] = {0};
double sumsq = 0.0;
GetData( *num, 3, 4 );
sumsq = sumsquares( *num, 3, 4 );
printf( "The sum of squares of each integer is: %.0f.\n", sumsq);
return 0;
}
/******************************* sumsquares() *********************************/
double sumsquares( int* num_ptr, int numrows, int numcols )
{
double sum = 0.0;
for ( int row = 0; row < numrows; ++row )
for ( int col = 0; col < numcols; ++col )
sum +=pow( num_ptr[row * numcols + col], 2.0 );
return sum;
}
/******************************* GetData() ***************************/
void GetData( int* num_ptr, int numrows, int numcols )
{
int row, col;
for ( row = 0; row < numrows; ++row )
{
printf( "Please input row %d of %d integers now: \n", row + 1, numcols );
for ( col = 0; col < numcols; ++col )
{
printf( "#%d: ", col + 1 );
scanf( "%d", &num_ptr[row * numcols + col] );
}
}
}