Vote.aggregate([
{$group: {_id: "$poll", "votes": {$sum: 1}}},
{$sort: {"votes": -1}},
{$lookup: {from: "polls", localField: "_id", foreignField: "_id", as: "pollObject"}} //from is the name of table in database
])
“char * p”和“char * p”有什么区别?
答案 0 :(得分:2)
没有区别,只是风格问题。
就像John Skeet在之前的评论(另一个主题)中所写的那样:
不同的人对此有不同的约定。
答案 1 :(得分:2)
char* p
和char *p
完全等同于。
在很多方面,你应该写char *p
,因为p
是指针到char
。但是随着岁月的流逝,大多数人认为char*
为p
的类型,所以char* p
可能更常见。
但请注意,char* p, q;
实际上将p
声明为{em>指针指向char
,将q
表示为char
!如果你想要两个指针,你必须写char *p, *q;
或令人难以置信的混淆
char* p, *q;
。
答案 2 :(得分:1)
char* p
和char *p
是相同的。与char*p
和char * p
一样。