Here, const
pointer hold the address of const
variable. like :
#include <iostream>
int main()
{
const int i = 5;
const int* ptr = &i;
}
It's working fine.
But, If I use using (Type alias) like:
#include <iostream>
using intptr = int*;
int main() {
const int i = 5;
const intptr ptr = &i;
}
GCC compiler gives an error. [Live demo]
Why pointer does not work with using
Type alias?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…