I have a function I would like to have a function to receive a 2D array (H), to read a specified column (col) and to pass it to another array (b). It appears that the code below is not OK has I was expecting to get a 1 printed. Any guidance is very much appreciated.
#define nline 5
#define ncol 4
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
void count0(int **M,int col, int *a);
void main(){
    int i;     
    int **H;
    H=(int**)malloc(nline*sizeof(int*));
    for(i=0;i<nline;i++){
        H[i]=(int*)malloc(ncol*sizeof(int));
    }
    H[0][0]=8;
    H[0][1]=5;
    H[0][2]=6;
    H[0][3]=0;
    H[1][0]=7;
    H[1][1]=5;
    H[1][2]=4;
    H[1][3]=0;
    H[2][0]=5;
    H[2][1]=1;
    H[2][2]=1;
    H[2][3]=7;
    H[3][0]=0;
    H[3][1]=0;
    H[3][2]=0;
    H[3][3]=2;
    H[4][0]=1;
    H[4][1]=0;
    H[4][2]=1;
    H[4][3]=4;
    int *b;
    int col=1;
    count0(H,col,&b); 
    printf("num 0=%d\n",b[2]); getchar();
}
/////////////////////////////////////////////////////////////////////////////////
void count0(int **M,int col, int *a){
    int i;
    a=(int*)malloc(1*sizeof(int));
    for(i=0;i<nline;i++){
        a[i]=M[i][col];
        a=realloc(a,(i+2)*sizeof(int));
    }
}
 
     
     
     
    