Month: June 2021


free(): It is a C library function that helps in freeing the memory. The behavior is undefined if ptr is not a pointer that has been returned by malloc(), calloc() or realloc() or if it has been already deallocated by realloc() or… Read More ›


realloc(): This is used to change the size of the memory which is already allocated by either malloc() or calloc(). It deallocates the memory pointer by ‘ptr’ and allocates a new memory space with the specified number of bytes given… Read More ›

Dynamic memory allocation

In C programming language, memory is allocated in two ways: Static memory allocation or compile time memory allocation Dynamic memory allocation or run time allocation Static Memory Allocation: The static memory allocation is also known as compile-time and in this… Read More ›

Interview question

Interview Question on malloc, calloc, realloc and free. What is the difference between malloc and calloc? One of the major differences between malloc() and calloc() is that in the case of malloc() the memory which is allocated is not initialized… Read More ›


calloc(): calloc() stands for contiguous allocation and is also used for allocating a specified number of bytes, given by the number of bytes to allocate and the size of each such object in bytes. It is normally used for allocating… Read More ›

Passing pointer to function

In the C programming language there is also a provision to pass a pointer to the functions as an argument other than variables. Example: Output: Since the address is passed(pass-by-reference), the value modified in the called function is also reflected… Read More ›

Pointer to structure

A pointer is a variable that holds the address of another variable. By the same logic, it can even store the address of the structure. Please refer to the topics below for a clear understanding before reading further: Array in… Read More ›

String and pointer

A string is a sequence of characters terminated with a null(‘\0’) character. C does not have a string of data types. Basically, string is a one-dimensional array of characters. For example, the string “techaccess” contains 11 characters including a null… Read More ›

Pointer to an array

Pointer is a variable that holds the address of another variable of the same datatype and an array is a variable that can hold multiple values but of a similar type (homogeneous). Thus, a pointer variable can store the address… Read More ›

Double pointer

Pointer is a variable that is used to store the address of other variables of a similar datatype. In the C programming language, there is a provision to store the address of the pointer variable in another variable. This variable… Read More ›