Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
用指针,做的RE的注意了注意字符串比较大小时,要先判断p是否是空指针即p==NULL,如果你们空指针比较就会RE while(p!=NULL&&strcmp(s->pathname,p->pathname)>0) { t=p; p=p->brother; } 这是对的 下面是错的 while(strcmp(s->pathname,p->pathname)>0&&p!=NULL) { t=p; p=p->brother; } 虽然只是顺序颠倒了,后面是先运行函数strcmp(s->pathname,p->pathname),而p是空指针,p->pathname根本不是字符串,所以会错误! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator