I have this weird error that is messing up my program.
When I pass a class object set to an int array and an int the program is not assigning them to the private variables in my class. I know for a fact that in my driver program both the array and int have values assigned to them. When I pass them though, they seem to disappear.
set::set(int array_input[], int counted)
{
used = counted;
for(int x = 0; x < used; used++)
{
data[used] = array_input[used]; //When I run debug, it tells me
//the problem is here. Now it the program just stops
//working as soon as it gets to this point.
}
}
My driver:
1 2 3 4 5 6 7 8
set first(array1, counter_one), second(array2, counter_two), subtraction;
// The arrays and the counters have values assigned to them in this part of
// the program. Both arrays and counters are of type int.
//The arrays were taken to a file and converted from string to int. This
//works successfully.
//The counters are the size of each corresponding array. I am trying to pass
//them into the private variable "used" so I can use it in my program.
Why is my program crashing as soon as it hits my constructor?
Thanks in advance!