MCQ Single Best Answer Easy

QWhat is the output of the following C code?

#include <stdio.h>

int main() {
    int arr[] = {1, 2, 3, 4, 5};
    printf("%d", *(arr + 2));
    return 0;
}

ID: #7202 Fundamentals of C Language 270 views
Question Info
#7202Q ID
EasyDifficulty
Fundamentals of C LanguageTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 1
  • B 2
  • C 3
  • D 4
Correct Answer: Option C

Explanation

Answer: C

Explanation: The expression *(arr + 2) is equivalent to arr[2], which accesses the third element of the arr array. Therefore, the output will be 3.

Share This Question

Challenge a friend or share with your study group.