|
C Programming Reference >> C Programming Reference Question Bank >> 19/07/07 - 377 Views - No Ratings Yet Level - Intermediate Question - Determine the output of the following code.
Answer - cd Explanation - If you have solve earlier questions you must by now knowing that array name without brackets returns its base address. Now answer does assume that sizeof int in the enviorment where this c code is compiled for output is 2bytes. Now p+= sizeof (int) points is same as p = p + 2 which points to argv [2]. Now on similar lines p += sizeof (int) [-1] is same as p = p + 2 - 1. When this memmory location is accesed, it outputs cd which is stored in argv [1] as expected. Reader Comments -
|
|||