Re: return an int from a function



I would like to have a function to process an input integer and return the
result.
The following code will generate a memory leak.

Do you have proof of this? None of the code actually shown will
leak memory. I see no calls to malloc() or cealloc() or realloc()
at all.

Gordon L. Burditt

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);
}
.



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)
  • [PATCH 1/3] Audit: break up execve argument lists into multiple records
    ... The limit is currently around 7.5k of arguments as userspace ... memory leak on a malloc failure code path. ... making it harder on the kernel to have the memory it needs. ... int audit_n_rules; ...
    (Linux-Kernel)
  • Memory leak problem
    ... After following the advice received in this list, I have isolated the memory leak problem I am having. ... List = initVoiceChannels(List, TempEvent); ... float generateRandomNumber(int intervalA, int intervalB, int incValues) { ... DLLIST *DLCreate(int Tag, void *Object, size_t Size) ...
    (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)