C Programming - Pointers - Discussion

Discussion Forum : Pointers - Find Output of Program (Q.No. 11)
11.
What will be the output of the program?
#include<stdio.h>

int main()
{
    int arr[2][2][2] = {10, 2, 3, 4, 5, 6, 7, 8};
    int *p, *q;
    p = &arr[1][1][1];
    q = (int*) arr;
    printf("%d, %d\n", *p, *q);
    return 0;
}
8, 10
10, 2
8, 1
Garbage values
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
58 comments Page 4 of 6.

Mani said:   1 decade ago
Thanks for the clear explanation raghul

Harishgoud said:   1 decade ago
Exactly the answer is right Mr. Rahul.

Sagar Kapadiya (Surat) said:   1 decade ago
Value if its a[ 2 ] [ 2 ] [ 1 ].. ?

Tanveerkhan guttal said:   1 decade ago
Nicely explained by Teklit Ehiopia.

Subhi said:   1 decade ago
Nicely explained by Teklit Ehiopia.

Yashwanth said:   10 years ago
Clearly explained. Thank you guys.

Subaa said:   1 decade ago
Nice explained chettan thank you.

Swetha K M said:   7 years ago
Nice explanations. Thank you all.

Kshirod said:   7 years ago
Good explanation, Thanks @Rahul.

Shalini said:   7 years ago
Good explanation. Thanks All.


Post your comments here:

Your comments will be displayed after verification.