thank you.
Type: Posts; User: durgadatta
thank you.
This is the code for counting characters, words and line in C program. (Pg 20, K&R)Why do we really need the variable "state" or why is it important to know if you are inside the word or outside the...
I have done this before use:
payoffs = (double ***)malloc(sizeof(double **)*players);
I think they are same, isnt it?
thank you.. Seems like optimisitc memory alocation in linux is the problem. I am working out. Its a fairly large program, will take some time.... its a new information whatsoever. thanks
Thats not the issue, its working for all values of temp less than 10^4.. anyway. My declaration and allocation is ; ( here MEM_ERROR is macro)
double ***payoffs = NULL; ...
Yes, I am using Fedora 13, x_86
I removed the casting but it made no difference. In other general case why does casting do potential harm?
section of my code is:
printf(" i am upto here %d %d\n", i, j);
payoffs[i][j] = (double *) malloc(sizeof(double)*temp);
if( payoffs[i][j] == NULL)
{
printf("Mem Error \n");
...
I think if we return a pointer to the meory allocated in user defined function we cant access it form outside sicne the scope of memory allocated inisde function is local. is it not so?
so does it not mean that its absolutely not necesarry to use free() if we malloc inside user defined function? Subsonics on first reply said tat we nee not free IF (only) we return reference to free...
but the memory occupied by other variables declared locally inside the user defined function can be used for other purpose once the funcion is returned. Doesnot this happen to allocated memory too...
do we need to free memory (free() ) in user defined fucntion if we have allocated using malloc? isn't tha automatically freed when the function returns. Is using free() inside function at all...
Do we need to free memory allocated by malloc inside user defined function? isn't that automatically freed when the function returns? suppose if we free using fee(), does it have any affect (need not...