- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Pointer vs Array in C
Pointers and array most of the time are treated as same in c. Some differences are:
&operator:
&pointer = returns the address of pointer.
&array = returns the address of first element.
sizeof operator:
sizeof(array) = returns the total memory consumed by the all the elements of the array.
sizeof(pointer) = returns the only memory consumed by the pointer variable itself.
Array variable can’t be re-assigned a value whereas pointer variable can.
Declaration:
int a[]; //array Int *p; //pointer
Let us consider that there is an integer pointer variable
int *i;
Now let us consider the outcome of the following assignments –
a = &i; //illegal assignment. a variable can not be updated or modified. p = &i; //legal assignment.
- Related Articles
- Scope Resolution Operator vs this pointer in C++
- Passing by pointer Vs Passing by Reference in C++
- Pointer to an Array in C
- Explain the concept of Array of Pointer and Pointer to Pointer in C programming
- Difference between pointer and array in C
- Double Pointer (Pointer to Pointer) in C
- Sum of array using pointer arithmetic in C++
- Sum of array using pointer arithmetic in C
- How to access array elements using a pointer in C#?
- Difference Between Array and Pointer
- Explain the concept of pointer to pointer and void pointer in C language?
- How to define pointer to pointer in C language?
- Pointer Arithmetic in C/C++
- C++ Program to Access Elements of an Array Using Pointer
- Function Pointer in C

Advertisements