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;
}
Discussion:
58 comments Page 1 of 6.
                
                        Shyamal said: 
                         
                        7 months ago
                
                [2][2][2]=8 position 
[1][1][2]=1 position
Answer is 8,10.
                [1][1][2]=1 position
Answer is 8,10.
                     (1)
                
            
                        ArunKumar A said: 
                         
                        12 months ago
                
                @All.
arr[0][0][0]={10, 2};
arr[0][0][1]={3, 4};
arr[0][1][1]={5, 6};
arr[1][1][1]={8, 0};
                arr[0][0][0]={10, 2};
arr[0][0][1]={3, 4};
arr[0][1][1]={5, 6};
arr[1][1][1]={8, 0};
                     (1)
                
            
                        Anmol singh said: 
                         
                        1 year ago
                
                Can anyone help me how 8 came? Anyone, please explain.
                
                     (1)
                
            
                        Nik said: 
                         
                        4 years ago
                
                Thanks @Rahul.
                
                     (1)
                
            
                        Priya said: 
                         
                        4 years ago
                
                Thanks@ Rahul Sharma.
                
                        Rashmi said: 
                         
                        5 years ago
                
                Great explanation. Thanks @Rahul Sharma.
                
                        Mohana said: 
                         
                        6 years ago
                
                Thank you @Rahul Sharma.
                
                        Ritu said: 
                         
                        6 years ago
                
                @Rahul Sharma.
Thank you, you have explained it very well.
                Thank you, you have explained it very well.
                        Sakshi munya said: 
                         
                        6 years ago
                
                Thank you @Rahul Sharma.
                
                        Deepak said: 
                         
                        7 years ago
                
                Can anyone explain this more clearly to get this?
                
                     (1)
                
            Post your comments here:
 
            
        Quick links
                            Quantitative Aptitude
                                    
                                    Verbal (English)
                                    
                                    Reasoning
                                    
                                Programming
                                    
                                    Interview
                                    
                                     Placement Papers