inputting elements inside a 2 dimensional dynamically allocated array
i want to input elements inside a 2 dimensional dynamically allocated array but unfortunatley it inputs only half of the elements of the declared size here is the code
Code:
#include<stdio.h>
#include<stdlb.h>
int main(){
int i,r,c; // no of rows and columns
scanf("%d",&r);
scanf("%d",&c);
int n=r*c; // n is the total no of elements
char**arr=malloc(r*c*sizeof(char*));
for(i=0;i<n;++i)
{
scanf("%c",&arr[i]);
}
free(arr);
return 0;
}