Skip to content

Tag Archives: Dynamic Memory Allocation

A list is a collection of similar or different types of data elements. Dynamic Language like python can store different data types in the same… Read More
Memory is divided into smaller addressable units called bytes. Assume that these are small boxes as bytes. Each byte has its own address as per… Read More
In this article, we will discuss the Dynamic initialization of objects using Dynamic Constructors. Dynamic initialization of object refers to initializing the objects at a… Read More
As we know that new is used to create memory dynamically and it is the programmer’s responsibility to delete the memory location explicitly and it… Read More
Given an array arr[] consisting of N integers, the task is to find the largest element in the given array using Dynamic Memory Allocation. Examples:… Read More
Memory Allocation: Memory allocation is a process by which computer programs and services are assigned with physical or virtual memory space. The memory allocation is… Read More
We use new and delete operators in C++ to dynamically allocate memory whereas malloc() and free() functions are also used for the same purpose in… Read More
Array of Objects: When a class is defined, only the specification for the object is defined; no memory or storage is allocated. To use the data… Read More
Since C is a structured language, it has some fixed rules for programming. One of them includes changing the size of an array. An array… Read More
Delete is an operator that is used to destroy array and non-array(pointer) objects which are created by new expression.  Delete can be used by either… Read More
Get a block of temporary memory. In C++ STL library, there is a function get_temporary_buffer which is mostly used to get a temporary block.  This… Read More
When you create a new object, memory is allocated using operator new function and then the constructor is invoked to initialize the memory. Here, The… Read More
The new and delete operators can also be overloaded like other operators in C++. New and Delete operators can be overloaded globally or they can… Read More
Consider the following program, where are i, j and k are stored in memory? int i; int main() {     int j;     int *k = (int… Read More
What is the problem with following code? #include<stdio.h> int main() {     int *p = (int *)malloc(sizeof(int));        p = NULL;        free(p); } (A) Compiler… Read More