Top "Free" questions

Do not use this tag to refer to free software.

How to free a pointer to a dynamic array in C?

I create a dynamic array in C with malloc, ie.: myCharArray = (char *) malloc(16); Now if I make a function like …

c pointers free dynamic-arrays
Should one really set pointers to `NULL` after freeing them?

There seem to be two arguments why one should set a pointer to NULL after freeing them. Avoid crashing when …

c pointers free
freeing memory of a binary tree C

I would like to free memory from my allocated binary tree what traversal is the best for doing so? typedef …

c free binary-tree
Correct usage of free() function in C

I am new in C programming language so can you tell me if this is correct way to do. for …

c pointers buffer free
Freeing strings in C

If I would write: char *a=malloc(sizeof(char)*4); a="abc"; char *b="abc"; do I need to free this …

c free
C++ Error in ' ' : free(): invalid pointer

I've read through similar problems, but I can't find anything that specifically addresses my problem (or I simply don't understand …

c++ templates free abort
Segmentation fault after free(), what are the common causes for this?

I get a segmentation fault after freeing a certain pointer: free(studentDB->name); I can get its value without …

c free segmentation-fault
How to free a struct that contains only pointers

I have a struct which you see below: typedef struct _List { Person *person; // pointer for people list DoList *do; // Kinda …

c struct free typedef
Using calloc() to set up char array, also "freeing" array when done

I'm trying to set up an array of strings (in C, using Linux). The array will hold 11 strings (static length). …

c arrays free calloc atexit
C - Does freeing an array of pointers also free what they're pointing to?

Say I have an array of pointers to structs that contain a string each and so for something like this: …

c free