Tuesday, October 30, 2012

Question 16: Predict the output.


Question 16: Predict the output. (Considering int for 4 bytes)

    void display(int data[])
    {
        std::cout<<"\nSize of array when passed as argument is : "<<sizeof(data);
    }

    int main()
    {
        int data[] = { 1, 2, 3, 4, 5, 6};

        std::cout<<"\nSize of array is : "<<sizeof(data);
        printSizeOfArray(data);
        
    }

    

    Options:
    (a) Size of array is : 24
         Size of array when passed as argument is : 4

    (b) Size of array is : 24
         Size of array when passed as argument is : 24

    (c) Compile Time error.

    (d) None of the above.



Show Solution

No comments:

Post a Comment