#include <iostream> #include<stdio.h> void prinfArray(int* nums, int size) { for (int i=0; i<size; i++) { printf("%d ", nums[i]); } printf("\n"); } int compare(void const* a, void const * b) { return *(int*)a - *(int*)b; } int main() { int array[] = { 2,1,5,0,7,8,2,6 }; int size = sizeof(array) / sizeof(array[0]); prinfArray(array, size); qsort(array, sizeof(array) / sizeof(array[0]), sizeof(int), compare); prinfArray(array, size); return 0; }
标签:prinfArray,函数,int,qsort,include,语言 From: https://www.cnblogs.com/shunguo/p/17722235.html