Re: return an int from a function




a wrote:

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?

How should I write this idea properly?

The way you have it below.

int func(int num){
//process the num, counting the loop
int result;
return result;
}
main(){
int result;
result = func(7);
}

.



Relevant Pages

  • Re: How does "new" work in a loop?
    ... freeware program that does this, but it requires all input and output ... My program seems to work fine, but I'm wondering about this loop: ... fsOut.Write(inputBuffer, 0, (int) inputBuffer.Length); ... Unlikely that you are creating a memory leak. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: return an int from a function
    ... I would like to have a function to process an input integer and return the ... The following code will generate a memory leak. ... int func{ ... //process the num, counting the loop ...
    (comp.lang.c)
  • Re: return an int from a function
    ... The following code will generate a memory leak. ... int func{ ... //process the num, counting the loop ...
    (comp.lang.c)
  • Re: return an int from a function
    ... I would like to have a function to process an input integer and return the ... The following code will generate a memory leak. ... int func{ ... //process the num, counting the loop ...
    (comp.lang.c)
  • Re: return an int from a function
    ... I would like to have a function to process an input integer and return the ... The following code will generate a memory leak. ... int func{ ... //process the num, counting the loop ...
    (comp.lang.c)