#include<stdio.h>
#include<stdlib.h>
int main()
{

    int **a,r,c,i,j,;
    printf("\n enter the size of row");
    scanf("%d",&r);
    printf("\n Enter the size of col");
    scanf("%d",&c);
    //allocating memory
    a = (int**)malloc (r*sizeof(int*));
        for(i = 0;i<r;i++)
            a[i] = (int*)malloc(c*sizeof(int));
            //array elements
            for(i = 0;i<r;i++)
            for(j = 0j<c;j++)
                scanf("%d",&a[i][j]);
                --------
                ---------

how to fill the array with random numbers

instead of scanf() call rand()

a[i][j] = rand();