Вы находитесь на странице: 1из 2

http://www.roseindia.net/c-tutorials/c-array-pointers.

shtml
A pointer is a variable that contains the memory location of another variable.
C array of pointers

In this section, you will learn how to create array of pointers.
A pointer is a variable that contains the memory location of another variable. The values you assign to the pointers are
memory addresses of other variables (or other pointers). A running program gets a certain space in the main memory.
Syntax of declarin a pointer:
data!type!name " variable name
First of all, specify the data type of data stored in the location, which is to identified by the pointer. The asterisk tells the
compiler that you are creating a pointer variable. Then specify the name of variable.
You can see in the given eample, we have created an array of pointers of maimum si!e ". Then we have assigned the
ob#ects of array pointer.
The address of the variable.
array#$% & 'x(
array#)% & 'y(
array#*% & '+(
,ere is the code:
A--A./0I.C
#include <stdio.h>
#include <conio.h>
main() {
clrscr();
int *array[3];
int x = 1! y = "! # = 3;
int i;
array[] = $x;
array[1] = $y;
array["] = $#;
for (i=; i< 3; i%%) {
&rint'(()he *alue o' +d= +d !address is +u,t ,n(! i! *(array[i])!
array[i]);
-
.etch();
return ;
-
0utput will be displayed as:
A--A./0I.121