i start to code on c++, i have good background from java, i have some issue with the syntax of C++. i stuck on one thing, i create a method "SortCloums" , and i missing something on it. in the for loop its give me a massage of :
expression must have pointer-to-object type
this is the short code of my, yes i still learning about pointers. need some direction of you guys.
#include <iostream>
using namespace std;
const int size = 4;
void SortCloums(int arr[size][size], int sizeOfArray);
int main(){
int arr[size][size] = { { 0, 4, 6, 0 },
{5, 6 , 8, 12},
{50, 8, 12, 24},
{900, 10, 30, 50} };
SortCloums(arr, size);
return 0;
}
void SortCloums(int arr ,int sizeOfArray) {
// now we check if the array is column sorted or not.
bool flag = true;
for (int i = 0; i < sizeOfArray && flag != false; i++){
for (int j = 0; j < sizeOfArray && flag != false; j++){
if (arr[j][i] > arr[j+1][i]){
flag = false;
std::cout << "The array of column unsorted" << endl;
std::cin.get();
}
}
}
if (flag == true){
std::cout << "The array is column sorted" << endl;
std::cin.get();
}
}