Variable x in a C Program is declared as int x[100]. Assume that each value of the array occupies one memory location, and the address of the starting memory is 2030, (a) what will be address of the last memory location? (b) What will be the address of x[15]?
Answers
Answered by
1
Answer:
a)2129 b) 2045
Explanation:
Since the memory is starting at 2030 and each array entry is taking 1 memory location
the first entry will i.e x[0](since array indexing starts at 0 not 1) will be at 2030, the next x[1] will be at 2031 and so on
this can be summarised as follows
x[0] at 2030 +0 = 2030
x[1] at 2030 + 1 = 2031
x[15] at 2030 + 15 = 2045
and the last element which is x[99] at 2030 +99 = 2129
Similar questions