Mar
23
#include<stdio.h>
void main(){
int r,c;
int i,j;
int *ptr;
printf(“Enter Number of Rows: “);
scanf(“%d”,&r);
printf(“Enter Number of Columns: “);
scanf(“%d”,&c);
ptr=(int*)malloc(r*c*sizeof(int));
for(i=0;i<r;i++){
printf(“Enter %d values for %d row:”,c,(i+1));
for(j=0;j<c;j++){
scanf(“%d”,(ptr+i*3+j));
}
}
for(i=0;i<r;i++){
for(j=0;j<c;j++){
printf(“%d\t”,*(ptr+i*3+j));
}
printf(“\n”);
}
}
Leave a Reply
No Comments