Matrix Printing using Pointers [closed]

Try

cout << *(a+i*(p+1)+j);

But I think the below will also work. (The relationship between m and n vs r and p needs clarification.

for(i = 0; i <= r; ++i)
    for(j = 0; j <= p; ++j)
        cout << *a++;

Leave a Comment