Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialFred Lawton
5,904 PointsMemory Address units?
Is this video correct? Since an int is say 2 bytes, then shouldn't the memory addresses for a 3 element int array be like 1000, 1002, and 1004? I guess I'm assuming the memory address is in units of bytes. Regardless of the specific units, this video seems to suggest that the memory address range of an array of 3 ints would be the same as an array of 3 doubles.
1 Answer
Amit Bijlani
Treehouse Guest TeacherThe example was simplistic to depict subscripting to access individual elements in an array. Each memory address does not represent bytes allocated. I didn't want to get into memory allocators because that is a lot more complicated. There are several algorithms on how memory is allocated which varies based on architecture and operating system.
Rodrigo Chousal
16,009 PointsRodrigo Chousal
16,009 PointsAmit Bijlani