maybe so late. but i also want to know if it's right.

guest (zack)
const int * x means "x" is a pointer which point to a int variable, and the variable is constant.

int const* x is the same meaning as above.

The key is the syntax is: "const" always combine with the left word, forever. (so we can say in instance 2, the "const" modify the "int");
But there is a exception: when the word is a simple type such as "int", "float"( not complex like class type), the "const" can be put to the right of the word such as "const int", just like the instance 1.

so this exception make the confuse. In fact it's the same.

2000-11-3 -04:00

回到话题: Jabber's Q(2):

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论