题解 | #字符串排序#

字符串排序

http://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723

num<101的时候内存竟然超限,为什么呢? #include <stdio.h> #include <stdlib.h> #include <string.h>

int compare(const voida,const voidb){ return strcmp((char *)*a,(char *)b); } int main() { int count=0,num=101; scanf("%d\n",&count); char **a=(char )malloc(sizeof(char)count); char b=(char)malloc(sizeof(char)numcount); for(int i=0;i<count;i++){ scanf("%s\n",b+inum); (a+i)=b+inum; } qsort(a,count,sizeof(char),compare); for(int i=0;i<count;i++) printf("%s\n",(a+i)); return 0; }

全部评论

相关推荐

风中翠竹:真的真的真的没有kpi。。。面试官是没有任何kpi的,捞是真的想试试看这个行不行,碰碰运气,或者是面试官比较闲现在,没事捞个人看看。kpi算HR那边,但是只有你入职了,kpi才作数,面试是没有的。
双非有机会进大厂吗
点赞 评论 收藏
分享
龙珠传说:nb,公务员解约不需要支付违约金吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务