PART I
C h a p t e r 2 0 :
U n s a f e C o d e , P o i n t e r s , N u l l a b l e T y p e s , a n d M i s c e l l a n e o u s T o p i c s
595
PART IPART I
To access the target value indirectly pointed to by a pointer to a pointer, you must apply
the asterisk operator twice, as in this example:
using System;
class MultipleIndirect {
unsafe static void Main() {
int x; // holds an int value
int* p; // holds an int pointer
int** q; // holds a pointer to an int pointer
x = 10;
p = &x; // put address of x into p
q = &p; // put address of p into q
Console.WriteLine(**q); // display the value of x
}
}
The output is the value of
Do'stlaringiz bilan baham: |