#include<stdio.h>   
#include<stdlib.h>
#include<string.h>
void find_col_num(int matrix[][5])
{
    printf("size of matrix = %d\n",sizeof(matrix));
    printf("size of one element = %d\n", sizeof(matrix[0][0]));
    printf("number of columns = %d\n", sizeof(matrix)/(sizeof(matrix[0][0])*5));
}
int main()
{
    int a[6][5] = { {0,0,0,0,0},
                    {0,1,1,1,1},
                    {1,0,1,0,0},
                    {1,0,1,0,0},
                    {1,0,1,0,0},
                    {0,1,1,1,1} };
    find_col_num(a);
    printf("\n\n\n");
    printf("size of a = %d\n",sizeof(a));
    printf("size of one element = %d\n", sizeof(a[0][0]));
    printf("number of columns = %d\n", sizeof(a)/(sizeof(a[0][0])*5));
    return 0;
}
Output:
size of matrix = 8
size of one element = 4
number of columns = 0
size of a = 120
size of one element = 4
number of columns = 6
I want to use sizeof in the void or int function for determine number of the matrix's column. I know that I have to specify number of the matrix's line in the function. How can I handle that?
 
    