# How to find the memory capacity? [closed]

A memory component spans the address range 0x00400000 to 0x007FFFFF, what is its capacity?

I only know the calculate the two address difference, i.e 3FFFFF,the correspond decimal is 4194303,convert this can get answer 4MB, but the standard answer like this:

## closed as unclear what you're asking by Dmitry Grigoryev, StainlessSteelRat, Edgar Brown, Sparky256, FinbarrMar 4 at 17:32

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• In a street there's an apartment building, each apartment has it's own number. On the building there is a sign: apartments 101 - 250. How many apartments are there in the building? I think it is 149. How did I calculate that? Now replace apartment numbers with memory locations. How many memory locations are there? – Bimpelrekkie Feb 28 at 13:15
• @Bimpelrekkie: Why aren't there 150 apartments? If you subtract 100 from the apartment number, you can count them, 1 to 150. Similarly, if you subtract 0x3FFFFF from the memory addresses, you can count those, too, 1 to 0x400000. If an address represents one byte (not specified in the question), that's 4 MB. But the question is about explaining the "standard answer" method, not getting the right answer. – Dave Tweed Feb 28 at 13:32
• @DaveTweed You're correct, the right answer is 150. I'll excuse myself by saying it was a deliberate mistake to trigger the sharp reader ;-) I personally do not see much difference between the two methods except that in the "standard method" the numbers are expressed as powers of 2. – Bimpelrekkie Feb 28 at 13:35
• Using pictograms for your username makes it difficult for many of us to direct comments to you. I can usually type a @ followed by the first few characters of a name, but I can't type the characters you use. It's your choice, of course, but I just wanted to understand how things work. – Elliot Alderson Feb 28 at 14:11
• You are doing subtraction, which is an efficient and universal solution. In contrast, the proposal given to you attempts to explain subtraction, but in a way restricted to aligned powers of two... Apart from neglecting to count both the first and last storage location, you are ahead of what was proposed to you. But sometimes in an educational context you can be asked to "do it their way" even when "their way" is inefficient and perhaps even confusing. – Chris Stratton Feb 28 at 17:06

• @TheOP International standards say that $10^6$ bytes equals one megabyte (MB) but $2^{20}$ bytes equals one mebibyte (MiB). Perhaps that is the source of your confustion. However, some people still use megabyte when they really mean mebibyte. – Elliot Alderson Feb 28 at 14:07