Home / C Programming / Pointers :: Find Output of Program

C Programming :: Pointers

  1. What will be the output of the program ?

    #include 
     int main() 
     {
         int i, a[] = {2, 4, 6, 8, 10};     
         change(a, 5);   
         for(i=0; i4; i++)         
           printf("%d, ", a[i]); 
        return 0; 
    } 
    void change(int *b, int n) 
    {
          int i;   
          for(i=0; i1) = *(b+i)+5; 
    } 
    

  2. A.

    7, 9, 11, 13, 15

    B.

    2, 15, 6, 8, 10

    C.

    2 4 6 8 10

    D.

    3, 1, -1, -3, -5

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. If the size of integer is 4bytes, What will be the output of the program?

    #include 
     int main() 
     {   
        int arr[] = {12, 13, 14, 15, 16};      
        printf("%d, %d, %d\n", sizeof(arr), sizeof(*arr), sizeof(arr[0])); 
        return 0; 
    } 
    

  4. A.

    10, 2, 4

    B.

    20, 4, 4

    C.

    16, 2, 2

    D.

    20, 2, 2

    View Answer

    Workspace

    Discuss Discuss in Forum