I have a matrix alocated dinamicaly:
This code is OK!Code:int **alocmat(int n) { int **a,i=0; a=(int**)calloc(n,sizeof(int*)); for(;i<n;i++) *(a+i)=calloc(n,sizeof(int)); return a; }
and now i try to read using pointers. the bolded line can work using a[i][j], but i want to write it using pointers. how can i do that?
Thank you!Code:void citire(int** a,int n) { int i=0,j; for(;i<n;i++) for(j=0;j<n;j++) { printf("[%d][%d]: ",i,j); scanf("%d",*(*(a+i)+j)); } }