beginner with classes. The following code didn't run with pointers. but ran fine without pointers or even with reference. error says:
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
///first few code for background
class vectorofint
{
public:
vectorofint();
void push_front(int value, int *ini_size);
private:
int *array;
};
vectorofint::vectorofint()///constructor with no arguement
{
array=newint[32];
}
///the code with pointer start here
void vectorofint::push_front(int value, int *ini_size)///problem in *ini_size
{
int *temp=newint[*ini_size];
for(int i=0;i<*ini_size;i++)
{
temp[i]=array[i];
}
delete array;
*ini_size++;
array=newint[*ini_size];
array[0]=value;
for(int i=1;i<(*ini_size);i++)
{
array[i]=temp[i-1];
}
delete temp;
}
int main()
{
int ini_size=22;
vectorofint a();
a.push_front(34, &ini_size);
}