English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I get ( syntax error ";" )for this code:

cin>>temp.grad_year;
temp.next=NULL;
new(p);
if(!p)
{ cout<<"Out of Memory"< return;

it points to this line of code: new(p);

why??????????

2007-02-28 08:52:23 · 2 answers · asked by COD 3 in Computers & Internet Programming & Design

2 answers

what 'type' is p supposed to be?

MyFunnyClass p = new();
if (!p)
{
cout << "oom" << endl;
}

there is a bit more 'missing', so that is just a guess...

new will instantiate an object, you are not assigning that new instantiation to anything...

2007-02-28 08:59:41 · answer #1 · answered by Clif S 3 · 2 0

Did you close your 'if" block? That's honestly the only thing I can think of...it looks correct to me. (But I also have only a little experience...)

2007-02-28 09:02:59 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers