pointer is a variable that contains the memory address as a value, different from ordinary variable that contains the specified value. In other words, the pointer contains the address of the variable that has a certain value. Thus, there are variables that directly points to a specific value and a variable that indirectly (a variable pointer) points to the value.
int * countPtr, count;
pointer operator
address operator (denoted as &) is a unary operator that returns the address of the operator. as an example, assume the following declaration:
int y = 5
int * yPtr;
examples of program code pointer : (....)
#pragma argsused
#include <iostream.h>
int main(){
void *z;
int p;
long x;
double r;
z=&p;
p=10;
cout<<"value p:"<<p<<endl;
cout<<"value z:"<<z<<endl;
//cout<<"value *z :"<<*z<<endl;
cout<<"value &p :"<<&p<<endl;
cout<<"\n";
z=&x;
x=20;
cout<<"value x:"<<x<<endl;
//cout<<"value *z :"<<*z<<endl;
cout<<"value z:"<<z<<endl;
cout<<"value &x :"<<&x<<endl;
cout<<"\n";
z=&r;
r=30;
cout<<"value r:"<<r<<endl;
//cout<<"value *z :"<<*z<<endl;
cout<<"value z:"<<z<<endl;
cout<<"value &r :"<<&r<<endl;
cout<<"\n";
cin>>x;
return 0;
}
source : http://web.ipb.ac.id/~julio/webaku/isi/kom202/notes/7.pdf
Category
- 4D program (1)
- ajax (1)
- corel (3)
- drawing in flash (2)
- flash (2)
- html (1)
- instalasion (1)
- photosoap (3)
- program (3)
Followers
Wednesday, August 31, 2011
Pointer
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment