, . , .
- , , -, ,
int * iptr;
iptr . , iptr , int.
&.
, i int:
int i;
- iptr i:
iptr = &i;
iptr i.
i , . *. Ÿ , .
, (iptr -, y int):
y = i; // y i
y = *iptr; // y , ,
// iptr, .. i
, :
*iptr = 10; // 10 , iptr
i, iptr, 10.
, . , iptr int. , :
unsigned short* uptr; //
char* ; //
-, . , - , .
, , - . , 32- 4 .
, , , .
, , .
|
|
, , 1. , , . , , . , .
, . ,
ptr+n
ptr , n , ptr, n*sizeof(*ptr).
, , ++ +=, . ,
ptr++;
ptr sizeof(*ptr), , ,
ptr+=2;
2*sizeof(*ptr).
. ptr , ( n*sizeof(*ptr), n ). -- -=.
. , . , () ().
. ( ), , .
. , . ,
xptr > 0x12FF00
,
xptr > (int*)0x12FF00
.
, , , . , , , , .
& * , (!, ~, -).
int i, *ip=&i;
*ip+1 (*ip)+1, *(ip+1).
C, C++, . ( ) C++. C , . , , , . , , , , , .
|
|
:
void swap1 (int* x, int* y)
{
int z=*y;
*y = *x;
*x = z;
}
int main ()
{
int a=0, b=1;
swap1 (&a, &b);
...
return 0;
}
, swap1 a b.