I'm a bit confused with memory allocation.
I want to fill a structure Sudoku with random number and then check if a box of 9 numbers are correct.
#define SUDOKU_SIZE 9 
typedef struct 
{ 
   int grid[SUDOKU_SIZE][SUDOKU_SIZE]; 
} sudoku_t;
int main(int argc, char const *argv[]){
    sudoku_t *s=malloc(sizeof s);
    s->grid[0][0]=6;//manualy setting the value of the sudoku
    ...
    s->grid[8][8]=7;
    fill_sudoku_test(s);//fill s, a feasible Sudoku with random number
    int k, l;
    for(k=0;k<SUDOKU_SIZE;k+=3){
        for(l=0;l<SUDOKU_SIZE;l+=3){
            if(correct_box(s,k,l))//check if a box of 3 by 3 contains 9 differents numbers
                printf("Box correct at position :%d and %d\n",k,l);
         }
    }
    free(s);
    return EXIT_SUCCESS;
}
When I compile this code, I got a core dumped error.
If somebody got a solution, I'm interested
EDIT
Here's the others functions :
void fill_sudoku_test(sudoku_t *s){
   int k, l;
   time_t t;
   srand((unsigned) time(&t));
   for(k=0;k<SUDOKU_SIZE;k++){
       for(l=0;l<SUDOKU_SIZE;l++){
           if(!(s->grid[k][l])) {
               s->grid[k][l]=rand()%SUDOKU_SIZE+1;
           }            
       }
   }
}
int correct_tab(int value[]){
   int i;
   int tab[9];
   for(i=0;i<SUDOKU_SIZE;i++){
      tab[i]=0;
   }
   for(i=0;i<SUDOKU_SIZE;i++){
      if(tab[value[i]-1]==1){
        return 0;
      }
      else{
        tab[value[i]-1]=1;
      }
   }
   return 1;
}
int correct_box(sudoku_t *s, int i, int j){
   int tab[SUDOKU_SIZE];
   int count=0;
   int k,l;
   for(k=0;k<3;k++){
      for(l=0;l<3;l++){
         tab[count]=s->grid[i+k][j+l];
      }
   }
   return (correct_tab(tab));
}
 
     
     
    