Initialize pointer to pointer using multiple address operators in C or C++

It just occurred to me That I don't know how to initialize a pointer to pointer from a non pointer value with one statement in C++:

int a = 1;
int** ppa = &&a; //Does not compile
int** ppa = &(&a); //Does not compile
int* pa = &a;   //Works but is a
int** ppa = &pa; //Two step solution

Am I missing something, is the two statement the one and only way to do it?

8
задан David Reis 27 September 2010 в 20:51
поделиться