Hello, basically I want to return an array from a function (So I don't output things in the class - just main)
But I seem to get the error: "invalid types 'int[int]' for array subscript"
Here is the code:
#include <iostream>
using namespace std;
int matrix()
{
int matrix[10] =
{
1, 1, 1, 1, 1,
1, 1, 1, 1, 1
};
return *matrix;
}
int main(int argc, char *argv[]) {
int matr = matrix();
for(int i=0; (i < 10); i++)
{
cout << matr[i] << "\t";
}
}
Any help would be great :)