Skip to content

Tag Archives: cpp-pointer

At the very high level, we can think of NULL as a null pointer which is used in C for various purposes. Some of the… Read More
A whole array cannot be passed as an argument to a function in C++. You can, however, pass a pointer to an array without an… Read More
In C, like normal data pointers (int *, char *, etc), we can have pointers to functions. Following is a simple example that shows declaration… Read More
The memcpy function is used to copy a block of data from a source address to a destination address. Below is its prototype. void *… Read More
A void pointer is a pointer that has no associated data type with it. A void pointer can hold address of any type and can… Read More
In this article, we will be discussing smart pointers in C++. What are Smart Pointers, why, and how to use them properly? Pointers are used… Read More
This post is an extension of How to dynamically allocate a 2D array in C? A one dimensional array can be easily passed as a pointer,… Read More
  Following are different ways to create a 2D array on the heap (or dynamically allocate a 2D array).In the following examples, we have considered… Read More
  Pointers are used for storing address of dynamically allocated arrays and for arrays which are passed as arguments to functions. In other contexts, arrays… Read More
C++ programming language allows both auto(or stack-allocated) and dynamically allocated objects. In Java & C#, all objects must be dynamically allocated using new.  C++ supports… Read More
Predict the output of following C programs.  C // PROGRAM 1 #include <stdio.h> int main(void) {     int arr[] = {10, 20};     int *p = arr;… Read More
To understand ‘this’ pointer, it is important to know how objects look at functions and data members of a class. Each object gets its own… Read More
Consider simple representation (without any dummy node) of Linked List. Functions that operate on such Linked lists can be divided into two categories: 1) Functions… Read More
this pointer refers to the current object of the class and passes it as a parameter to another method. In C++, this pointer is passed… Read More
Ideally delete operator should not be used for this pointer. However, if used, then following points must be considered.1) delete operator works only for objects… Read More

Start Your Coding Journey Now!