Search:

Type: Posts; User: durgadatta

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    1,713

    thank you.

    thank you.
  2. Replies
    3
    Views
    1,713

    Word Count example in Book by K & R

    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...
  3. I have done this before use: payoffs =...

    I have done this before use:


    payoffs = (double ***)malloc(sizeof(double **)*players);


    I think they are same, isnt it?
  4. thank you.. Seems like optimisitc memory...

    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
  5. Thats not the issue, its working for all values...

    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; ...
  6. Yes, I am using Fedora 13, x_86 I removed...

    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?
  7. mallocs giving segmentation fault without returning NULL

    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");
    ...
  8. Replies
    11
    Views
    2,143

    I think if we return a pointer to the meory...

    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?
  9. Replies
    11
    Views
    2,143

    so does it not mean that its absolutely not...

    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...
  10. Replies
    11
    Views
    2,143

    but the memory occupied by other variables...

    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...
  11. Replies
    1
    Views
    1,470

    Freeying Memory

    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...
  12. Replies
    11
    Views
    2,143

    Freeying Memory

    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...
Results 1 to 12 of 12