0

size of array and memory

Just so i understand this alittle better. If an array is addressing memory space how big is an array size of 1? If i have misunderstood please dont troll me but please correct me in my understanding thank you

15th Aug 2017, 9:43 PM
Nathaniel Wilsher
2 Answers
+ 3
An array of size 1 is 1 byte. If you are talking about an array with one element, then the sizeof the array would be the sizeof the type, such as int, bool, double, etc.
15th Aug 2017, 9:55 PM
aklex
aklex - avatar
+ 2
As far as i know, every pointer i have observed with the debugger till now are 4 bytes big, so an array of size 1 (that contains a pointer to a memory) is 4 bytes. I once read somewhere pointers of 8 bytes (when researching about qt or void *) but i don't have any knowledge about that.
15th Aug 2017, 9:57 PM
EagleEye
EagleEye - avatar