English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2006-06-08 05:38:15 · 4 answers · asked by aish_0506 1 in Computers & Internet Programming & Design

4 answers

array means collection of similar objects
and pointer points to a particular address or location
in a programming language

eg. pointer to an array point to the address of
first element of that array

2006-06-08 05:45:30 · answer #1 · answered by anron4u 2 · 0 0

All of these answers are correct, but i dont think the difference is real clear yet. First, think of memory as a stack (not a real 'stack' but as a visual image this works well) where each level has an address:

--------
| data | address
--------
| data | address
--------
| data | address
--------
| data | address
--------

an array with 4 elements would look real similar to this, but there needs to be an indicator as to the length, so array[0] *is a pointer* to the first element of the array and if you were to read the entire array you would see a:
-------
| null | address
-------

at the end of it. so making an array "hi there" would actually make "hi there/0" so things like printf() know when to stop.

So, as you can see, I said that an array (in the c family) uses pointers to reference elements, this means the pointer array[index] actually means 'i want the data stored at array[0] + index".

The difference is subtle because array's use pointers and array's are more of a 'protocol' than a programming element. a pointer is very specific: 'give me the data at this address', an array is a contiguous list of addresses that have similar data ending with a null character.

2006-06-08 13:55:29 · answer #2 · answered by Anonymous · 0 0

An Array is a collection or list of items held under a single variable name and accessed by the variable name along with a subscript.
Each programming language will have it's own rules and syntax for the usage of arrays and the starting subscript.

A pointer is usually a variable that holds a memory location.
Again languages that allow pointers will have their own syntax as to the use of pointers.

2006-06-08 12:48:48 · answer #3 · answered by AnalProgrammer 7 · 0 0

ARRAY MEANS TO ARRANGE IN ORDER, WHERE POINTER MEANS SOMETHING THAT POINTS OUT, AN INDICATOR.

2006-06-08 12:41:56 · answer #4 · answered by Anonymous · 0 0

fedest.com, questions and answers