

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 to an Array in C
Pointers are variables which stores the address of another variable. When we allocate memory to a variable, pointer points to the address of the variable. Unary operator ( * ) is used to declare a variable and it returns the address of the allocated memory. Pointers to an array points the address of memory block of an array variable.
The following is the syntax of array pointers.
datatype *variable_name[size];
Here,
datatype − The datatype of variable like int, char, float etc.
variable_name − This is the name of variable given by user.
size − The size of array variable.
The following is an example of array pointers.
Example
#include <stdio.h> int main () { int *arr[3]; int *a; printf( "Value of array pointer variable : %d\n", arr); printf( "Value of pointer variable : %d\n", &a); return 0; }
Output
Value of array pointer variable : 1481173888 Value of pointer variable : 1481173880
In the above program, an array pointer *arr and an integer *a are declared.
int *arr[3]; int *a;
The addresses of these pointers are printed as follows −
printf( "Value of array pointer variable : %d\n", arr); printf( "Value of pointer variable : %d\n", &a);
- Related Questions & Answers
- Double Pointer (Pointer to Pointer) in C
- Pointer vs Array in C
- Explain the concept of Array of Pointer and Pointer to Pointer in C programming
- C++ Program to Access Elements of an Array Using Pointer
- How to access elements of an array using pointer notation in C#?
- Difference between pointer and array in C
- How to define pointer to pointer in C language?
- Sum of array using pointer arithmetic in C++
- Sum of array using pointer arithmetic in C
- Explain the concept of pointer to pointer and void pointer in C language?
- How to access array elements using a pointer in C#?
- C program to display relation between pointer to pointer
- Pointer Arithmetic in C/C++
- NULL pointer in C
- void pointer in C
Advertisements