Skip to content

Tag Archives: C-Advanced Pointer

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 CA pointer is used to point to a memory location of a variable.… 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 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
Output of following program #include <stdio.h> int fun(int arr[]) {    arr = arr+1;        printf("%d ", arr[0]); } int main(void) {    int arr[2] = {10, 20};… Read More
#include <stdio.h> #include <stdlib.h>    int main(void) {     int i;     int *ptr = (int *) malloc(5 * sizeof(int));        for (i=0; i<5; i++)         *(ptr +… Read More
#include <stdio.h> int main() {     int a[][3] = {1, 2, 3, 4, 5, 6};     int (*ptr)[3] = a;     printf("%d %d ", (*ptr)[1], (*ptr)[2]);     ++ptr;     printf("%d… Read More
Assume that the size of int is 4. #include <stdio.h> void f(char**); int main() {     char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl"… Read More
Predict the output #include <string.h> #include <stdio.h> #include <stdlib.h>    void fun(char** str_ref) {     str_ref++; }    int main() {     char *str = (void *)malloc(100*sizeof(char));… Read More
#include <stdio.h>    char *c[] = {"GeksQuiz", "MCQ", "TEST", "QUIZ"}; char **cp[] = {c+3, c+2, c+1, c}; char ***cpp = cp;    int main() {… Read More
#include <stdio.h> int main() {     int a[5] = {1,2,3,4,5};     int *ptr = (int*)(&a+1);     printf("%d %d", *(a+1), *(ptr-1));     return 0; } (A) 2 5 (B) Garbage… Read More
Assume sizeof an integer and a pointer is 4 byte. Output? #include <stdio.h>    #define R 10 #define C 20    int main() {    int… Read More
void fun(int *p)  {    int q = 10;    p = &q;  }           int main()  {    int r = 20;    int *p = &r;    fun(p); … Read More

Start Your Coding Journey Now!