I am trying to create a new array with positive values only taken from a already created array, and when I am looping through the original array, the index has an error "Expression must have pointer to object type" I tried doing research on the error, and everyone's situation is different when getting this error so I am on my own with this. Here is my code:
int foo::createNewArray() const {
int newarray[50];
int oldarray = oldarray[values];
int size = (sizeof(oldarray));
for (int i = 0; i > size; i++){
if (oldarray[i] > 0)
newarray[i] = oldarray[i];
}
The "i" above is what has the error. the oldarray[values] is declared in a seperate class file. Here is the small section of the code where it comes from.
class foo{
int oldarray[1];
enum unit {values};
public:
int createNewArray() const;
};