写代码注意
guozhichao94
这个作者很懒,什么都没留下…
展开
-
注意for循环中新开并且反复使用的node
for(int i=0;i<m;i++){ scanf("%d",&temp1);scanf("%d",&temp2);scanf("%d",&temp3); node* edge=new node; edge->w=temp3;edge->v=temp2; node* Nedge=new node; Nedge->w=temp3;Nedge->v=temp1; . }原创 2014-12-17 11:09:16 · 797 阅读 · 0 评论 -
I/O注意
scanf("%d",&temp1);scanf("%d",&temp2);scanf("%d",&temp3); scanf("%d%d%d",&temp1,&temp2,&temp3); 尽量避免使用第一句,改用第二句.原创 2014-12-20 01:33:14 · 325 阅读 · 0 评论 -
三目运算符作为左值时的使用注意
三目运算 ? : 作为左值 需要整体加上括号, 如下: ((p->parent->lc == p)?p->parent ->lc:p->parent ->rc ) = NULL; 注意上式最外围的那个括号必须存在,否则=赋值会优先进行.原创 2015-01-11 23:50:06 · 736 阅读 · 0 评论