SN. | Array | Pointer |
1. |
An array is a collection of data items, all of the same types, accessed using a common name.
|
A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. |
2. | It is the collection of similar types of data. | It is a variable that stores the memory address of another variable. |
3. | Dynamic allocation and deallocation are not allowed. | Dynamic allocation and deallocation are allowed. |
4. | It doesn't increase the execution speed of the program. | It increases the execution speed of the program. |
5. | It is declared as data_type array_name[size_of_the_array] | It is declared as data_type *pointer_name |
6. | Example of declaration int a[20]; |
Example of declaration int *p; |
7. |
Example:
|
Example:
|
|
|