You are here:

C++/Array vs Structures Memory efficieniency


I have a qustion.  Why is it better to use structures than arrays.  Is it because it uses less memory?  If it does how does it do it and why?

Kenny , Thank you for your question.

Except in certain cases where structures are padded, there is no difference in the amount of memory used by a structure or an array. They are different ways to access memory locations; arrays use element indices and structs use member variable names.

David Spector


All Answers

Answers by Expert:

Ask Experts


David Spector


Highly knowledgeable in the C++ language, Visual C++ (MSVC), Windows API, documentation and other quality-assurance techniques, and debugging. Knowledgeable in MFC, COM, GUI design, and object-oriented design.


I have been a software engineer since 1965. I have been published. My specializations have been: biomedical programming, compiler implementation, and many kinds of Windows programming. I don't do Databases or other business-oriented stuff.

Windows?/DOS Developer's Journal, ACM SIGPLAN Notices, and Computer Science Press.

ICCP Systems Programming Certification
Master's degree equivalent in Computer Science

©2017 All rights reserved.

[an error occurred while processing this directive]