Tuesday, July 28, 2009

SImple C++ Sytnax?

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





cin%26gt;%26gt;temp.grad_year;


temp.next=NULL;


new(p);


if(!p)


{ cout%26lt;%26lt;"Out of Memory"%26lt;%26lt;endl; //Success


return;





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





why??????????

SImple C++ Sytnax?
what 'type' is p supposed to be?





MyFunnyClass p = new();


if (!p)


{


cout %26lt;%26lt; "oom" %26lt;%26lt; 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...
Reply: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...)

orange

No comments:

Post a Comment