answersLogoWhite

0


Best Answer

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
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

By elements, or as an unit.

This answer is:
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
Related questions

Array in c plus plus must be defined at compil time?

No. Arrays can be defined at runtime, just as they can in C. It's just that it's generally more convenient to use vectors instead of dynamic arrays at runtime, thus arrays are generally used statically, at compile time.


What is the Difference between arrays in c and c plus plus?

Nothing whatsoever. They are exactly the same.


How do you swap two arrays in c plus plus using string?

You can't. While a string is a character array, an array is not necessarily a string. Treating arrays as if they were strings simply to swap them is madness. The correct way to physically swap arrays A and B is to copy A to a new array, C, then copy B to A, then C to B. If the arrays are the same size this is not a problem. If they are different sizes, you can only swap them if they are dynamic (not static). This means you must reallocate them. To speed up the process, copy the smallest array to C, first. A much better approach would be to point at the two arrays and swap the pointers instead.


Do you have pointer concept in c plus plus language?

Yes. All string variables are pointers as are other arrays.


What is the required syntax for creating C arrays?

The required syntax for creating C arrays include the brackets, array size, variety length arrays, codes like std:vector, classPTR, and many more to create C arrays.


How are devices treated in C plus plus?

On some platforms (unix, for example) devices are handled as special files.


What is the only function all C plus plus programs must contain?

Every C plus plus program that is a main program must have the function 'main'.


Example program arrays in turbo c plus plus?

Yes, you can use for-loop in a C program compiled by Turbo C.


What is multidimensional array in c plus plus?

A multidimensional array in C or C++ is simply an array of arrays, or an array of an array of arrays, etc. for however many dimensions you want. int a; // not an array int a[10]; // ten int a's int a[10][20]; // twenty int a[10]'s, or 200 int a's int a[10][20][30]; // and so on and so forth...


A program for queue ADT by using arrays in c plus plus?

Arrays are not suitable for implementing queues because while they are ideal for adding to the end, the are not ideal for extraction from the beginning. For that you need a deque. Regardless, the STL (standard template library) already provides an efficient queue ADT in std::queue.


What is the difference between C plus plus and the D language?

D essentially evolved from practical usage of C++ and added features found in other languages including C#, Eiffel, Java, Python and Ruby. D has garbage collection, design by contract, unit testing, true modules, first class arrays, associative arrays, dynamic arrays, array slicing, nested functions, inner classes, closures, anonymous functions, compile time function execution, lazy evaluation, a re-engineered template syntax and integrated inline assembler.


What is an arrays in c?

array is collection of many data