What is the output of this code?
int *p = calloc(3, sizeof(int));
printf("%d %d %d", p[0], p[1], p[2]);
Consider reallocating memory:
int *p = malloc(10);
p = realloc(p, 20);
Which allocation method is most suitable for a dynamically growing linked list?
How can you safely check if malloc() succeeded?
In the context of dynamic memory, what does 'memory fragmentation' refer to?
Advertisement
What will happen if you try to allocate extremely large memory?
int *p = malloc(INT_MAX);
Which best practice prevents memory leaks in complex programs?
What does realloc() do if the new size is smaller than the old size?
What will be the output of this code?
int *p = (int*)malloc(5 * sizeof(int));
printf("%d", sizeof(p));
Which statement about free() is correct?
In dynamic 2D array creation:
int arr = (int)malloc(m * sizeof(int*));
what does the first malloc() allocate?
What happens if you use a pointer after calling free() on it (without reallocating)?
Which scenario best demonstrates a memory leak?
What is the output of this code?
int *p = (int*)calloc(3, sizeof(int));
printf("%d %d %d", p[0], p[1], p[2]);
If realloc() cannot expand memory at the current location, what does it do?
In competitive exams, why is dynamic allocation preferred over static arrays for unknown input sizes?
What is the correct way to allocate a dynamic array of struct for 'n' elements?
struct Node { int data; char name[20]; };
A competitive programmer allocates a 2D array dynamically. What is the correct approach?
Consider a program that repeatedly allocates memory in a loop but never frees it. What problem occurs?
What happens if you call free() twice on the same pointer?