

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


#include <stdio.h> #include <stdlib.h>
/* prototype of function print that accept a pointer to pointer (in other words
int main() { int r=3,c=5,i,j; // int a1[2][4]={{1,2,3,4},{5,6,7,8}}; int **aptr; // pointer to pointer
// initializing arrays of pointer of size r aptr=(int)malloc(rsizeof(int)); for(i=0;i<r;i++) { aptr[i]=(int)malloc(csizeof(int)); // initializing each pointer with array size of c of interger } printf("Done with initializing \n\n\n"); for (i=0;i<r;i++) { for(j=0;j<c;j++) { aptr[i][j]=rand()%20; } } printf("Done with initialization Value \n\n\n");
for (i=0;i<r;i++) { for(j=0;j<c;j++) { printf( "aptr[ %d ][ %d ] = %d\n",i ,j,aptr[i][j] ); } } printf("Going in to function \n\n\n"); print(aptr,r,c); printf("Coming out of function \n\n\n");
/*
return 0; }
/* Definition of function print that accept a pointer to pointer (in other words
// there is a bit difference from what we do before. printf( "Pointer dereference ar = %d \n",(((ar+i))+j));
} } }