C语言 冒泡排序
作者:互联网
#include "stdio.h"
#include "string.h"
void MaoPao(int* s, int num);
int main()
{
int buf[] = { 1,23,12,11,32,12,123,15 };
int bufNum = sizeof(buf) / sizeof(int);
MaoPao(buf, bufNum);
for (int i = 0; i < bufNum; i++)
{
printf("%d,",buf[i]);
}
}
void MaoPao(int* s,int num)
{
for (int i = 0; i < num; i++)
{
for (int j = i; j < num; j++)
{
if (s[i] < s[j])
{
s[i] ^= s[j];
s[j] ^= s[i];
s[i] ^= s[j];
}
}
}
}
标签:int,冒泡排序,C语言,++,num,MaoPao,bufNum,buf 来源: https://blog.csdn.net/weixin_44291381/article/details/120433518