Advertisement Remove all ads

Look at the Following C++ Code and Find the Possible Output from the Options (I) to (Iv) Following It. Also, Write the Highest and Lowest Values that Can Be Assigned to the Array A. - Computer Science (C++)

Look at the following C++ code and find the possible output from the options (i) to (iv) following it. Also, write the highest and lowest values that can be assigned to the array A.

Note:

  • Assume all the required header files are already being included in the code
  • The function random(n) generates an integer between 0 and -1
void main()
{
   randomize();
   int A(4], C;
   for(C=0; C<4; C++)
      A(C] = random(C+l) + 10;
   for (C=3; C >= 0; c--)
       cout<<A(C]<<"@";
}

1) 13@10@11@10@

2) 15$14$12$10$

3) 12@11@13@10@

4) 12@11@10@10@

Advertisement Remove all ads

Solution

13@10@11@10@

Concept: Pointers and Arrays - Array of Pointers, Pointer to an Array (1 Dimensional Array), Function Returning a Pointer, Reference Variables and Use of Alias
  Is there an error in this question or solution?
Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×