×

Loading...

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.
(#13097@0)
2000-11-3 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: Jabber's Q(2):

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论