Home / C Programming / Arrays :: Discussion

Discussion :: Arrays

  1. What will be the output of the program ?

    #include 
    
     int main() 
     {   
         static int arr[] = {0, 1, 2, 3, 4};   
        int *p[] = {arr, arr+1, arr+2, arr+3, arr+4};   
        int **ptr=p;     
        ptr++;     
        printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);    
    *ptpr++;     
       printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);     
     *++ptr;     
      printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);     
      ++*ptr;     
      printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr);     
      return 0; 
    }
    

  2. A.

    0, 0, 0
    1, 1, 1
    2, 2, 2
    3, 3, 3

    B.

    1, 1, 2
    2, 2, 3
    3, 3, 4
    4, 4, 1

    C.

    1, 1, 1
    2, 2, 2
    3, 3, 3
    3, 4, 4

    D.

    0, 1, 2
    1, 2, 3
    2, 3, 4
    3, 4, 5

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    No answer description available for this question.


Be The First To Comment