题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/d2f088e655d44e4a85c16f7b99126211
#include <stdio.h> #include <stdlib.h> #include <string.h> int cmp(const void * c1, const void * c2){ return *(char*)c1 - *(char*)c2; } int main() { char a[30]; scanf("%s", a); qsort(a, strlen(a), sizeof(a[0]),cmp); puts(a); return 0; }