[ create a new paste ] login | about

Link: http://codepad.org/dsICBile    [ raw code | output | fork ]

C, pasted on Jul 10:
#include<stdio.h>
void f(int (*m)[7]){  // As Nawaz answred
 printf("%d\n", m[3][3]);

}
void _f(int m[6][7]){ // As I commented 
 printf("%d\n", m[3][3]);

}
void _f_(int m[][7]){// Second form of Nawaz's answe 
 printf("%d\n", m[3][3]);

}
void f_(int (*m)[6][7]){// Pointer of 2D array
 printf("%d\n", (*m)[3][3]);
}

int main(){

    int matrix[6][7] = {
    {0, 0, 1, 1, 1, 0, 0},
    {0, 0, 1, 3, 1, 0, 0},
    {0, 0, 1, 4, 1, 0, 0},
    {0, 0, 1, 5, 1, 0, 0},
    {0, 0, 1, 6, 1, 0, 0},
    {0, 0, 1, 7, 1, 0, 0}
    };
    f(matrix);
    _f(matrix);
    _f_(matrix);    
    f_(&matrix);
    return 1;
}	


Output:
1
2
3
4
5
5
5
5


Create a new paste based on this one


Comments: