UPDATE:

I've just tried to compile your code and it went smoothly but there is the same runtime error as before on line:

ptr->info=x*temp + ptr->info;

You said this code works so I guess it has something to do with compiler?
Which one are you using?