傻问题,但我试图掌握其基本机制/哲学以巩固我的理解。
int myInt; // declares a variable of type integer, named myInt. Intuitive.
int* myPtr; // declares a variable of type pointer-to-integer. Also intuitive.
int myInt2, myInt3; // two more integer variables.. yay!! This makes sense.
// so the pattern is [type] [identifier] <,more-identifiers>;
int* myInt4, myInt5; // an int pointer then an integer. Brain hurts!
int *myPtr;
和int *myInt4, myInt5;
。 - endolithint*
传递到模板中,而int*
也可以成为某个东西的类型。据我所知,唯一不适用于此规则的地方是变量声明符中,其中指针是标识符的一部分!即使在这种情况下,如果您只声明一个变量,它也是不可见的。我知道这是因为C是这样工作的,但我认为这会让人感到头痛。 - jpfx1342