/*How to use malloc for 2d array dynamic memory allocation. How to write 2-d array with dynamic memory allocation */
#include<stdio.h>
#include<malloc.h>
int main()
{
int r,c,i,j;
printf("Enter
No of rows and columns:");
scanf("%d%d",&r,&c);
int **array;
array=(int**)malloc(r*sizeof(int));
for(i=0;i<r;i++)
{
array[i]=malloc(c*sizeof(int));
}