诡异的bug之dlopen

阅读 40

2023-11-19

#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)

0 0 举报