i'm having a really hard time with this one:
class foo
{
private:
char* p;
public:
foo(int);
};
foo::foo(int j)
{
p = new char[j];
p[0] = '1';
p[1] = '2';
};
int main(void)
{
foo k(2);
return 0;
}
why can't i set the value of p[1]? p[0] passes ok, while p[1] = '2' is just
ignored.
please help
--
You're never too young to have a Vietnam flashback