Skip to content

Tag Archives: C-Pointer Basics

Prerequisite: Classes, Constructors, Initializer list In this article, we will discuss the order of execution in the initializer list in C++. Generally, the order of… Read More
In C++, cout shows different printing behaviour with character pointers/arrays unlike pointers/arrays of other data types. So this article will firstly explain how cout behaves… Read More
Pointers: A pointer is a variable that holds memory address of another variable. A pointer needs to be de referenced with * operator to access… Read More
Prerequisite: Pointer in C and C++, Double Pointer (Pointer to Pointer) in C A pointer is used to point to a memory location of a… Read More
Pointers variables are also known as address data types because they are used to store the address of another variable. The address is the memory… Read More
NULL Pointer: The integer constant zero(0) has different meanings depending upon it’s used. In all cases, it is an integer constant with the value 0,… Read More
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 address of variables or a memory location. Syntax: datatype *var_name; Example: pointer “ptr” holds address of an integer variable or holds address of… 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
Prerequisite: Pointers There is a lot of confusion when char, const, *, p are all used in different permutaions and meanings change according to which… Read More
#include <stdio.h> void f(char**); int main() {     char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" };     f(argv);     return 0; } void f(char **p)… Read More
#include <stdio.h> int main() {     int arr[] = {1, 2, 3, 4, 5};     int *p = arr;     ++*p;     p += 2;     printf("%d", *p);     return 0;… Read More
#include<stdio.h>    void swap (char *x, char *y) {     char *t = x;     x = y;     y = t; }    int main() {     char… Read More
#include<stdio.h> void fun(int arr[]) {   int i;   int arr_size = sizeof(arr)/sizeof(arr[0]);   for (i = 0; i < arr_size; i++)       printf("%d ", arr[i]); }    int… Read More
int main() {  char *ptr = "GeeksQuiz";  printf("%c\n", *&*&*ptr);  return 0; } (A) Compiler Error (B) Garbage Value (C) Runtime Error (D) G Answer: (D)… Read More