|
C Programming Reference >> C Programming Reference Question Bank >> 19/07/07 - 464 Views - Ratings : Question - Output of this program will be?
Answer - 9 Explanation - This is a little tricky question and the output can be easily found if you apply the basics. First thing to remember is that array is always passed by refrence. So intially when array 'a' is passed to function 'function' then parameter 'b' will be pointing to base address of 'a' that is a[0][0]. Now when statement ++b is executed theb b will now get incremented and will point to a[1] [1] which now acts as base address of b. Now if we map the value b[1] [1] it will be same as a[2] [1]. Now when value of b[1][1] changes to 9 so does a[2][1] since it has been passed by refrence. As a result when a[2] [1] is displayed 9 is the output. Reader Comments -
|
|||