Rewriting my code to dynamic memory allocation
Hey guys,I'm having a go at re-writing a simple enough code I did, to use dynamic memory
here is the header and the main
ptr = new int;
*ptr = 100;
Would this work?
Re: Rewriting my code to dynamic memory allocation
Please repost the code with line breaks; it's unreadable as just a single line.
Also please use code blocks for all code.
Regarding your question, I couldn't see "Cash=100" anywhere, but on the face of it (a) yes it should work; (b) why didn't you try it instead of asking here; (c) why would you want to do it this way anyway - what's the benefit of using a pointer?
|All times are GMT +5.5. The time now is 10:04.|