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

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

ReneRene
Change my mind. I dare you.
Chat with Rene
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
More answers

By elements, or as an unit.

User Avatar

Wiki User

14y 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