|
C - function declearation
|
|
01-08-2010, 07:37 AM
Post: #1
|
|||
|
|||
|
C - function declearation
Hi Guys,
I have written the program for accesssing elements of 2D array using pointer to array of int which is as below: void display(int (*)[4], int , int); int main() { int a[2][4] = {{1,2,3,4}, {5,6,7,8} }; display(a, 2, 4); // this line is giving error getch(); } void display(int (*ptr)[4], int row, int col) { int i, j; int *p; for(i = 0; i < row; i++) { p = ptr + i; for( j= 0; j < col; j++) { printf("%d ", *(p+j)); } printf("\n"); } } But the function declearion line is giving the error and also I am not sure about function prototype written correct or not. Please help me in how the function prototype and declearation has to be written for the above fucntion defination. Thanks r4 dsi |
|||
|
« Next Oldest | Next Newest »
|
Current time: 09-06-2010, 10:36 PM




