题解 | #字符串排序#

字符串排序

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; }

全部评论

相关推荐

机械打工仔:有说的你怀疑一下就行了,直接问也太实诚了
点赞 评论 收藏
分享
自学java狠狠赚一...:骗你点star的,港卵公司,记得把star收回去
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-07 13:35
虽然不怎么光彩,经过这件事,可能我真的要去认同“面试八股文早该淘汰!不会用AI作弊的程序员=新时代文盲!”这句话了
HellowordX:Ai的出现是解放劳动力的,不是用来破坏公平竞争环境的,这样下去,轻则取消所有线上面试,严重了会影响整个行业对所有人产生影响,企业会拉高入职考核各种离谱考核会层出不穷
你找工作的时候用AI吗?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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