Question:

Do we need to delete the pointer? in C Pgming?

by Guest45155  |  earlier

0 LIKES UnLike



Fun1 ()

{

static char *ptr;

ptr= (char*) malloc(10);

}

Memory Leak is detected or not?

 Tags:

   Report

2 ANSWERS


  1. CAN YOU BE MORE CLEAR PLZ  


  2. Yes, you do need to free memory, not just delete pointer. It goes like this:

    Fun1 ()

    {

    static char *ptr;

    ptr= (char*) malloc(10);

    free(ptr);

    }

    If you dont free this memory it's memory leak.

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.