I'm trying to make a small program that swaps two columns and I have to use functions in order to do that but I just started on c++ and I cant get what I do wrong.
#include <iostream>
using namespace std;
int colSwap(int ng, int ns, int pin[][ns]) {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 4; ++j) {
cout << " i:" << i << " j:" << j << " " << pin[i][j] << " " << endl;
}
cout << endl;
}
}
int main() {
int ng = 3;
int ns = 4;
int pin[3][ns] = {{1, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12}};
colSwap(ng,ns,pin);
return 0;
}
I know that write it this way
int colSwap(int pin[][4]) {
}
but i need another method