Question
What will be the output of the following C code?
#include < stdio.h > void main ( ) { Ā Ā int x = 10, y = 20, *p1 = &x, *p2 = &y; Ā Ā *p2 = *p1 + *p2; Ā Ā printf ("%d %d\n", x, y); }Solution
The code demonstrates pointer manipulation in C. Hereās a breakdown: ⢠int x = 10, y = 20; declares two integers, x and y. ⢠*p1 = &x, *p2 = &y; initializes p1 to point to x and p2 to point to y. ⢠*p2 = *p1 + *p2; fetches the values of x and y through p1 and p2 respectively, adds them, and assigns the result back to y via *p2. After this operation, y becomes 30, while x remains 10. Output: 10 30. Why Other Options Are Incorrect: 1. 10 20: This would occur if no pointer manipulation happened, but the code modifies y. 2. 30 10: Only y is updated, not x. 3. Compiler error: The code is syntactically correct and compiles successfully. 4. Undefined behavior: The pointers are used properly with valid memory addresses, avoiding undefined behavior.
Which of the following will not affect cash flows under indirect method when reconciling profit to net cash from operating activities?
Which of the following best describes capital work-in-progress (CWIP)?
As per Ind AS 1, comprehensive income includes:
Which document shows changes in equity during the reporting period?
While preparing the statement of profit and loss, ABC Ltd. classifies its revenue from sale of products under āOther Income.ā Is this in compliance ...
In the context of a company, calls-in-arrears is shown:
As per Schedule III of the Companies Act, where should 'Unpaid Dividend' and 'Unclaimed Matured Deposits' be shown in the balance sheet?
While preparing financial statements under Schedule III of the Companies Act, 2013, which of the following items must mandatorily be disclosed under "Ot...
As per Ind AS 16, subsequent expenditure on property, plant and equipment is capitalized when it:
Under Schedule III, which of the following is classified under āOther Current Liabilitiesā?