Open In App
Related Articles

C | Advanced Pointer | Question 7

Improve Article
Save Article
Like Article

Assume that the size of int is 4.

#include <stdio.h>
void f(char**);
int main()
    char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" };
    return 0;
void f(char **p)
    char *t;
    t = (p += sizeof(int))[-1];
    printf("%s\n", t);

(A) ab
(B) cd
(C) ef
(D) gh

Answer: (D)

Explanation: The expression (p += sizeof(int))[-1] can be written as (p += 4)[-1] which can be written as (p = p+4)[-] which returns address p+3 which is address of fourth element in argv[].

Quiz of this Question

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads