my prgram is telling me that r cant equal a variable that isnt in the scope but it was in the argument call?
int main(){
int r = 12;
cout << "r";
return r; }
my prgram is telling me that r cant equal a variable that isnt in the scope but it was in the argument call?
int main(){
int r = 12;
cout << "r";
return r; }
int main(int arr[], int n) is not a valid signature for main(), so right off the bat your code has undefined behavior. Since you don't use any command-line parameters, use int main() instead.
Also, don't use <bits/stdc++.h>.
But, regarding your code logic, when main() is calling insertionSort() and printArray(), it is passing a pointer to the invalid arr rather than the populated vector array. But fixing that, &array[sizeArray] would be out of bounds of the vector, it needs to be &array[0] instead, or better array.data(). And n does not hold the size of the vector, you need to use sizeArray instead, or better array.size().
Try this instead:
int main() {
...
insertionSort( array.data(), array.size());
printArray( array.data(), array.size());
}