Skip to content

Tag Archives: C-Pointers

NULL pointer in C At the very high level, we can think of NULL as a null pointer which is used in C for various… Read More
Pointers store the address of variables or a memory location. Syntax: datatype *var_name; Example: pointer “ptr” holds the address of an integer variable or holds… Read More
Given an array of size n, the task is to sort this array using pointers in C. Examples: Input: n = 5, arr[] = {0,… Read More
Given a string. The task is to check if the string is a palindrome or not using pointers. You are not allowed to use any… Read More
Write a function to implement quicksort algorithm that will work for all types of data i.e ints, floats, chars etc. It should accept all types… Read More
New programmers are usually in the search of ways to return multiple values from a function. Unfortunately, C and C++ do not allow this directly.… Read More
Prerequisite: Pointers vs References in C++. For clear understanding, let’s compare the usage of a “pointer to pointer” VS “Reference to pointer” in some cases.… Read More
Prerequisite: How to dynamically allocate a 2D array in C?  Double pointer: A pointer pointing to another pointer is known as a Double pointer. To… Read More
Whenever we use const qualifier with variable name, it becomes a read-only variable and get stored in .rodata segment. Any attempt to modify this read-only… Read More
What is Segmentation Error ? – It is the runtime error caused because of the memory access violation. For Eg :-Stackoverflow, read violation etc.. We… Read More
Prerequisite : Pointers in C/C++, Memory Layout of C Programs.   To pass arguments by reference. Passing by reference serves two purposes (i) To modify variable… Read More
Why Subtraction is allowed? Two addresses can be subtracted because the memory between the two addresses will be valid memory. Let’s assume memory Ptr_1 and ptr_2… Read More
Prerequisite : Pointers in C Question 1 : What will be the output of following program?  C #include "stdio.h" int main() {     char a[] =… Read More
Consider below C program. // A C program to demonstrate need of strict  // aliasing #include<stdio.h>    // Value of 'a' can be accessed/modified either… Read More
Prerequisite : Pointers in C/C++ Given an array, write a program to reverse it using pointers . In this program we make use of *… Read More

Start Your Coding Journey Now!