Question:
Why this error free program not giving desired output?
anonymous
2012-01-12 09:10:36 UTC
void main()
{
int m,n,k;
cout<<"enter rows,columns";
cin>>m>>n;
for(int i=0;ifor(j=0;jcin>>a[i][j];
p=&a[0][0];
k=m*n;
for(i=0;i{
cout<<*p;
p++
}
getch();
}
Three answers:
?
2012-01-12 09:17:20 UTC
You don't state what the desired and actual output is, but on the first glance, I see several simple errors in your error-free program:

- You don't declare j

- You don't declare i the second time you use it. The first declaration of i is only valid in the scope of the loop that you use it in.

- You don't declare a or p either.

- p++ is missing the ;
sylvain
2012-01-12 09:16:27 UTC
where was p declared? also try to show up the contain of the variable after you enter them on the keyboard to be sure they have been stored.
Skylark
2012-01-12 09:32:29 UTC
the pointer p is nt declared i guess


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...