python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
How to find the size of chunk allocated by malloc in the glibc library?
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char * ptr1 = NULL;
char * newptr = NULL;
ptr1 = (char *) malloc(8 * sizeof(int));
if (ptr1 == NULL)
exit(EXIT_FAILURE...
arka
Votes: 0
Answers: 1
How to free DAG-like data structure
I have the following DAG (Directed Acyclic Graph) data structure:
struct dag {
struct dag **children; // Array of pointers to DAGs
int n_children; // Number of children
};
I want thi...
lemnis
Votes: 0
Answers: 2
Why i have to assign NULL to pointer after freeing allocated memory?
My question is why i have to assign NULL to pointer after freeing allocated memory?
free(*ptr);
*ptr = NULL;
I mean situation like this, why it is necesssary?
MASTERSI PL
Votes: 0
Answers: 0
How to free memory properly?
Please help, I can't figure out how to free memory correctly. There is a code below
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INT_MSG_LEN 25;
enum {NO_ERRO...
Khimer
Votes: 0
Answers: 1