adplus-dvertising
frame-decoration

Question

What is the output of this program?
#include <stdio.h>
int main()
{
    int arr[5] = {1,2,3,4,5};
    int p, q, r;
    p = ++arr[1];
    q = arr[1]++;
    r = arr[p++];
    printf("%d, %d, %d", p, q, r);
    return 0;
}

a.

3 4 5

b.

3 4 4

c.

4 3 4

d.

4 4 5

Answer: (c).4 3 4

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?