answersLogoWhite

0


Best Answer

A single memory position variable can store only one value of its type.

An array can store n number of values, where n is the size of the array.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do arrays differ from single memory position variables?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Why memory is divided into initialized and uninitialized areas?

The program's data segment. This area of memory is allocated by the linker and is used to store the program's global variables, static variables, static arrays and constants. Constants are always initialised, as are static variables, but global variables and static arrays need not be initialised.


What are arrays in gwbasic?

These are memory locations to store a vast amount of data. Usually a limited no. of variables are handled while programming in GW Basic. Sometimes you need to bother a plenty of variables and this colud make programming tiresome. To save yourself from a lot of manual inputs, Arrays can help you.


Why array does not store the data permnantly?

Arrays, just as normal variables, store information in RAM memory. When power is turned off, the contents of RAM memory get lost. For permanent storage, you'll have to write information to a file, or access a database.


Difference between dynamic and static memory allocation?

Static memory allocation is memory allocated on the "stack" and cannot be resized after the initial allocation, while dynamic memory allocation is memory allocated in the "heap", and can be dynamically expanded and shrunk as necessary.


What is the purpose of using arrays in C language?

The purpose of using arrays in C is to store multiple values in one variable. Then you can make programs that use arrays like lists, printing values from multiple arrays into one line. It take memory in continues block then we can know memory location easily. We can retrieve data quickly.

Related questions

Why memory is divided into initialized and uninitialized areas?

The program's data segment. This area of memory is allocated by the linker and is used to store the program's global variables, static variables, static arrays and constants. Constants are always initialised, as are static variables, but global variables and static arrays need not be initialised.


What are arrays in gwbasic?

These are memory locations to store a vast amount of data. Usually a limited no. of variables are handled while programming in GW Basic. Sometimes you need to bother a plenty of variables and this colud make programming tiresome. To save yourself from a lot of manual inputs, Arrays can help you.


Why array does not store the data permnantly?

Arrays, just as normal variables, store information in RAM memory. When power is turned off, the contents of RAM memory get lost. For permanent storage, you'll have to write information to a file, or access a database.


Difference between dynamic and static memory allocation?

Static memory allocation is memory allocated on the "stack" and cannot be resized after the initial allocation, while dynamic memory allocation is memory allocated in the "heap", and can be dynamically expanded and shrunk as necessary.


What is memory variables?

Hard to tell, variables usually are in the memory... be more specific.


What is the purpose of using arrays in C language?

The purpose of using arrays in C is to store multiple values in one variable. Then you can make programs that use arrays like lists, printing values from multiple arrays into one line. It take memory in continues block then we can know memory location easily. We can retrieve data quickly.


What is memory leakage in terms of arrays?

leakage in arrays occur when you declare an array with big size and using only very few bytes.


What is the difference between a pointer and an array in C programming?

An array is a contiguous block of memory containing one or more elements of the same type. The array identifier is a reference to that block of memory. References do not require any memory other than the memory they reference. References are not variables -- they are merely aliases for memory addresses. A pointer is a variable that can store any reference and provides indirect access to that reference. Pointers can be used to allocate arrays dynamically, which means memory is required not only for the array, but also for the pointer to store the starting memory address of the array. Once allocated, the array can be referenced directly, but the pointer is still required in order to release the memory allocation when it is no longer required. Arrays employ pointer arithmetic to locate individual elements by their zero-based index, which is essentially an offset from the reference multiplied by the size of the element type. However arrays and pointers are not the same from a programming standpoint. Your compiler may well implement references as pointers, but that is only of concern to compiler authors, not programmers. Two-dimensional dynamic arrays make use of a pointer-to-pointer variable to point to a one-dimensional array of pointers, each of which points to a one-dimensional array of the actual elements. A three-dimensional array employs a pointer-to-pointer-to-pointer to point to a one-dimensional array of pointer-to-pointer variables, each of which points to a two-dimensional array. And so on. Static arrays use less memory as there is no need to maintain arrays of pointers, but static arrays are only useful when the number of elements and dimensions are known at compile time. At runtime, arrays of pointers are required over and above the array elements themselves, in order to both allocate and deallocate the memory, as well as obtain references to the elements in the array. Pointers also have uses beyond that of dynamic arrays, including allocating any type of memory of any size, and pointing at functions which can then be passed as arguments to other functions.


What are some of the benefits of using an array as opposed to a medium-sized list of variables?

Arrays exist in contiguous memory, so you can use simple pointer arithmetic to access any element by its offset from the start address (the array name is an alias for the start address), and can pass the entire array to functions as a single entity. Lists of variables are not guaranteed to exist in contiguous memory, and cannot be passed to functions as a single entity.


Dynamically allocated array waste storage and time?

It's actually not true. In order to make a good program which can work with big arrays you have to use dynamic arrays because you can cleam memory used by dymanic arrays any time. For static arrays is not true, memery which was reserved for static arrays will be available for other applications only when you finish working with your application (which is working with static arrays).


What is Arrays of Pointers?

An array of pointers is a contiguous block of memory that contains pointers to other memory locations. They essentially allow non-contiguous memory locations to be treated as if they were an actual array.


What are the advantage do you have using dynamic memory allocation over static memory?

Static allocations are only useful when you know precisely the type and number of variables your program will use. While fixed size arrays of any size can certainly be allocated statically, the only way you can allocate a variable length array statically is by allocating more memory than you will ever use even in the worst case scenario. This is clearly impractical since some of that memory will never be used at all and most of it will only seldom be used. Local variables, on the other hand, make use of the current thread's stack to improve memory consumption, instantiating variables on an as-required basis with very little cost in terms of performance. However, unlike static memory, the call stacks have very limited capacity and are therefore unsuitable for large data structures, particularly variable length structures. Thus it makes more sense to dynamically allocate variable length arrays on the heap. The only real cost is in terms of the physical allocation but, once allocated, there is no difference in terms of access times compared to static or stack memory. It is all the exact same memory after all.