0
点赞
收藏
分享

微信扫一扫

诡异的bug之dlopen

小飞侠熙熙 2023-11-19 阅读 36
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

static Comp(const void *a, const void *b)
{
char *pa = (char *)a;
char *pb = (char *)b;

return strcmp(a, b);
}

int main(void)
{
char strs[3][10] = { "bd", "am", "kn" };
qsort(strs, 3, sizeof(strs[0]), Comp);
for (int i = 0; i < 3; ++i) {
printf("%s ", strs[i]);
}


return 0;
}

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

static Comp(const void *a, const void *b)
{
char *pa = (char *)a;
char *pb = (char *)b;

return strcmp(a, b);
}

int main(void)
{
char strs[3][10] = { "bd", "am", "kn" };
qsort(strs[0], 3, sizeof(strs[0]), Comp);
for (int i = 0; i < 3; ++i) {
printf("%s ", strs[i]);
}


return 0;
}

举报

相关推荐

0 条评论