xxxxxxxxxx
#include <stdio.h>
// Formal parameters as pointers
int calculateSum_type(int* arr, int row, int col) {
int i, j;
int sum = 0;
// traversing through the 2-D array
for (i = 0; i < row; i++) {
for (j = 0; j < col; j++) {
sum += * ((arr + i * col) + j); // accessing value from the address
}
}
return sum; // return final value
}
int main() {
// declaration and initialization of array “marks”
int marks[2][3] = {{10,20,30},{17,5,20}};
printf("Total marks %d ", calculateSum_type((int * ) marks, 2, 3));
return 0;
}