C Programming - Pointers - Discussion

Discussion Forum : Pointers - Point Out Correct Statements (Q.No. 6)
6.
Which of the statements is correct about the program?
#include<stdio.h>

int main()
{
    int arr[3][3] = {1, 2, 3, 4};
    printf("%d\n", *(*(*(arr))));
    return 0;
}
Output: Garbage value
Output: 1
Output: 3
Error: Invalid indirection
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
27 comments Page 1 of 3.

TNS said:   1 decade ago
The given array is a 2-D array, so we can access all the elements using double pointer. Triple pointer is not needed.

Sang said:   1 decade ago
How to told error is found ?

Wikiok said:   1 decade ago
Error: ***arr == arr[0][0][0], but arr has only 2 dimension.

Vijay said:   1 decade ago
@Wikiok.

Hai you said very well.

Swapnil said:   1 decade ago
Thanks Wikiok.

Nora said:   1 decade ago
Thanks Wikiok

Mini said:   1 decade ago
Thanks Wikiok

Shrikant said:   1 decade ago
Thanks Wikiok

Inderpal said:   1 decade ago
@ WIKIOK right answer.....

Kunal said:   1 decade ago
As we have given two dimensional error so it can have only pointer to pointer means only two *.


Post your comments here:

Your comments will be displayed after verification.