How many elements of type int can be stored in an array occupying 99 bytes of memory?
What is the memory address of the element with index 16 in an array of type unsigned short int if the address of the first element of the array is 26,449?
Answer:
Part 1:
One element of type int is of 4 bytes.
Therefore 99 bytes will be able to store 24 element of type int (because 99/4=24.75).
Part 2:
The memory address of the element with index 16 will be 26,481.
One element of unsigned short int is of 2 bytes.Therefore for every index memory will get increamented by two times as shown in the table below.
INDEX |
MEMORY ADDRESS |
0 |
26,449 |
1 |
26,451 |
2 |
26,453 |
3 |
26,455 |
4 |
26,457 |
5 |
26,459 |
6 |
26,461 |
7 |
26,463 |
8 |
26,465 |
9 |
26,467 |
10 |
26,469 |
11 |
26,471 |
12 |
26,473 |
13 |
26,475 |
14 |
26,477 |
15 |
26,479 |
16 |
26,481 |
Note--
Please upvote if you like the effort.
Get Answers For Free
Most questions answered within 1 hours.