Question discussion

Consider the following code snippet. What will it print?

358832Medium DSSSB TGT Computer Science 0 replies 0 views
0
Consider the following code snippet. What will it print?
#include <stdio.h>
int main() {
    char str[][10] = {"one", "two", "three"};
    printf("%c\n", str[2][4]);
    return 0;
}
  • Ar
  • Be
  • Cthree
  • Dh
Correct answer: B

Explanation

str[2] is "three" and index 4 is the fifth character, 'e' (t-h-r-e-e). So it prints e.

Discussion 0

Nobody has replied yet. Start the discussion!