I want to have an array whose values be declared from main to a class. Here's the sample code.
class test{
public:
const double arr[];
};
int main(){
test t;
t.arr[] = {1, 2};
return 0;
}
When I try to intialize in the main it gives me an error error:unexpected expression.
But if I remove the t.arr[]
in main, it compiles fine.