🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Pointers and 2D Arrays: all 15 questions

Quiz: Pointers and 2D Arrays · Question 6 of 15

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    const char *s[] = {"red", "green", "blue"};
    printf("%c%c", s[1][0], *s[2]);
    return 0;
}
  1. A.rb
  2. B.gb
  3. C.gr
  4. D.Compile error
Answer & explanation

Correct answer: gb

s[1][0] is the first letter of "green" and *s[2] is the first letter of "blue".

Can you get the rest right without peeking?

Take the timed Quiz: Pointers and 2D Arrays quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →