Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

C | Pointer Basics | Question 17

  • Difficulty Level : Hard
  • Last Updated : 12 Nov, 2020

#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: argv is a pointer array of type char. So it contains character pointers like ab, cd, etc. f(argv) in this call we give address of the first char pointer ab. in function f , t = ( argv[0] += 4 (its size of int) [-1] . after this evaluation t points to ij but after [-1] t will point to gh.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!