1、C语言排序
#include<stdio.h> #include<stdlib.h> int cmp(const void* _a, const void* _b) { int a = *(int*)_a, b = *(int*)_b; return a-b;//a-b是从左到右增大 } int main(){ int nums[]={4,3,2,1}; int numsSize =sizeof(nums)/sizeof(int); qsort(nums, numsSize, sizeof(int), cmp); return 0; }
标签:const,nums,int,C语言,嵌入式,sizeof,用法 From: https://www.cnblogs.com/LPworld/p/17129922.html