answersLogoWhite

0

How do you locate memory in array?

User Avatar

Anonymous

9y ago
Updated: 8/20/2019

The array name is a reference to the start address of the array, so simply take its address.

int a[10];

int* p1 = &a;

If the array is allocated on the heap, then there is no name (all allocations on the heap are anonymous). However, you don't need a name since you already know the address:

int* p2 = malloc (10 * sizeof (int));

User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

What is the need of array?

congugative memory allocation ,is use to array


What is the need of array variables?

congugative memory allocation ,is use to array


How will you find the location of an element of an array?

Basically, &array[i]; That is, the memory location for an array object with index i. Or, you can do: (array + i);


What are array of string pointers?

An array of pointers to string would contain, per array position, a number dictating which memory address holds the string data. For example, position [0] in an array would contain a memory address. This memory address can be de-referenced to obtain the actual information held within that memory address.


How to display the content of memory address stored in an element of an array?

void *array[2]; printf ("array[%d]=%p\n", i, array[i]);


Passing an array name to a pointer assigns the first memory location of the array to the pointer variable?

Yes, passing an array name to a pointer assigns the first memory location of the array to the pointer variable. An array name is the same as a pointer to the first location of the array, with the exception that an array name is a r-value, while a pointer is an l-value.


What an array?

An array is an aggregate of data elements of the same type. Arrays are allocated in contiguous memory. An element of an array can be another array type, also known as a multi-dimensional array.


Differencs link list and array?

An array is a contiguous section of computer memory that contains elements of equal size. A linked list are non-contiguous sections of memory that contain data that is dynamically allocated and released as necessary. Arrays are fixed in size. Changing the size requires significant processing power. They are quick to retrieve an element by index in the array. Finding elements in the array requires less code, and so is also faster. They also use less memory, since only one memory "pointer" is needed to locate the entire array. Arrays are best used when there are many elements and the overall size of the array will not change often. Linked lists are variable in size. Changing the size requires virtually no processing power relative to arrays. Finding an element by index requires significant processing power. They use more memory, as each element requires at least one additional "pointer" to locate another node (some use two). Linked lists are best used when there are a limited number of elements that will be fairly often added and removed in a way that would incur the array's high cost of resizing itself frequently.


How delete an array of object within the object in C?

First locate the position of an array by search after than use a delete function to delete an array


Does array save memory?

No, it use memory, just like any other variable.


What is the term given to the memory allocation that takes place during run time rendering the resizing of an Array?

A reallocation. Note that whenever we reallocate an array, we increase the size of the current allocation if there is sufficient free memory beyond the current allocation or we allocate entirely new memory if there isn't. But when we reduce the size of an array, we simply release the redundant memory at the end of the array; we never allocate new memory. However, because the amount of memory being allocated has to either increase or reduce in size, both are termed a reallocation.


In what are various cells of memory allocated consecutively?

Contiguous memory address are allocated to an array or vector.