if I have a C function where I return a pointer to a malloc-ated memory location like -->
int *example0{
int *ptr;
ptr = malloc(10);
ptr[0] = '1';
return ptr;
}
call that function twice and at the first function call do not free() the ptr
int example2{
int *exmple = example0();
}
int example3{
int *exmple2 = example0();
free(exmple2);
}
does C run the compiled example0 function twice or does C only return the ptr to the not free()-ed pre "filled" memory-location at the second function call?
If: C does run the function twice, how can I not waste computing time at running the function twice?