#include<iostream.h>
#include<conio.h>
void main()
{
int n,i,j,m,a[10][10],*p[10];
clrscr();
cout<<"enter the order of matrix ";
cin>>m>>n;
cout<<"\nenter the elements of matrix: ";
for(i=0;i<m;i++)
{
p[i]=&a[i][0];
}
//p[0]=t[0];
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>*(*(a+i)+j);
}
}
//*p=&a[0][0];
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<" "<<*(*(p+i)+j);
}
cout<<"\n";
}
getch();
}
OUTPUT:
#include<conio.h>
void main()
{
int n,i,j,m,a[10][10],*p[10];
clrscr();
cout<<"enter the order of matrix ";
cin>>m>>n;
cout<<"\nenter the elements of matrix: ";
for(i=0;i<m;i++)
{
p[i]=&a[i][0];
}
//p[0]=t[0];
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>*(*(a+i)+j);
}
}
//*p=&a[0][0];
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<" "<<*(*(p+i)+j);
}
cout<<"\n";
}
getch();
}
OUTPUT:
No comments:
Post a Comment