"a" <> writes:
> Hi
> I would like to have a function to process an input integer and return the
> result. The following code will generate a memory leak. How should I write
> this idea properly?
> Thanks
>
> int func(int num){
> //process the num, counting the loop
> int result;
> return result;
> }
> main(){
> int result;
> result = func(7);
> }
There is no memory leak in the code you posted.
If you have code that leaks memory, show it to us. We're not mind
readers.
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.