answersLogoWhite

0

If the array is static it can declared in the structure itself:

struct myArrayTag

{

int num[12]; // array of 12 integers (e.g., 48 bytes).

} myArray;

If it is dynamic then you must use a pointer and allocate the array outside the structure. You should also maintain a variable in the structure to keep track of how many elements the array currently has:

struct myBufferTag

{

int * array; // Pointer to array of integers.

int size; // Size of array (number of elements);

} myBuffer;

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
ReneRene
Change my mind. I dare you.
Chat with Rene
More answers

By elements, or as an unit.

User Avatar

Wiki User

15y ago
User Avatar

Add your answer:

Earn +20 pts
Q: How arrays must be handled in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp