“Type *Name"和“Type *Name"有什么区别?并输入*名称"? [英] What is the difference between "Type *Name" and Type* Name"?
本文介绍了“Type *Name"和“Type *Name"有什么区别?并输入*名称"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 C++ 的新手,我在任何地方都找不到将*"放在类型之后或名称之前的区别.比如waht就是两者的区别:
I am new to c++ and i couldn't find anywhere what is the difference between when you put the '*' after the type or before the name. For example waht is the difference between the two:
int *p;
int* p;
推荐答案
C 编译器忽略空格(字符常量和字符串字面量中的空格除外).
C compiler ignores the whitespace (except whitespace inside character constants and string literals).
意思是
int * p;
int*p;
int* p;
int *p;
int * p ;
意思完全一样.
空格仅在宏中很重要,例如:
The white space is only important in macros for example:
#define a(x) ((x)+(x))
#define a (x) ((x)+(x))
意味着完全不同的东西.
mean something completely different.
这篇关于“Type *Name"和“Type *Name"有什么区别?并输入*名称"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文