Don't know how to declare matrix using pointers and passing into the function and also not getting any useful resource from internet.
void wavePrint (int* arr[],int m)
{
for (int i = 0; i < m; ++i){
if(i%2==0) for(int j = 0; j < m; ++j)cout<<*(arr[j])<<" ";
else for (int j = m-1; j >= 0; --j)cout<<*(arr[j])<<" ";
}
}
int main(int argc, char const *argv[])
{
int* arr[5]={
{1, 2, 3, 4, 5},
{6, 7, 8, 9, 10},
{11, 12, 13, 14, 15 },
{16, 17, 18, 19, 20 },
{21, 22, 23, 24, 25 }
};
wavePrint(*arr,5);
}
Aucun commentaire:
Enregistrer un commentaire