当前位置:网站首页>The sorting in C language realizes the number sorting method from small to large
The sorting in C language realizes the number sorting method from small to large
2022-07-04 06:23:00 【Tears like eating hot pot】
Abstract : For project development , Sometimes I want to be right ADC Sort the collected voltage , And then come to a stable ADC value , Sorting is essential .
get_value[10] = {23,10,9,75,22,33,0,8,6,20};
int main(void)
{
for (uint8_t i = 1; i < 10; i ++)
{
for (uint8_t j = 0; j < 10 - i; j ++)
{
if (get_value[j] > get_value[j + 1])
{
tmp = get_value[j];
get_value[j] = get_value[j + 1];
get_value[j + 1] = tmp;
}
}
}for(uint8_t i = 0;i<10;i++)
{
printf("get_value[%d] = %d ,",i,get_value[i]);
}
}
result :
0,6,8,9,10,20,22,23,33,75,
边栏推荐
猜你喜欢

R统计绘图-随机森林分类分析及物种丰度差异检验组合图

Cloud native - SSH article that must be read on the cloud (commonly used for remote login to ECS)

JS execution mechanism

注释与注解

Json Web token - jwt vs. Traditional session login Authentication

InputStream/OutputStream(文件的输入输出)

《ClickHouse原理解析与应用实践》读书笔记(4)

Matlab remainder

Arcpy 利用updatelayer函数改变图层的符号系统

buuctf-pwn write-ups (8)
随机推荐
Json Web token - jwt vs. Traditional session login Authentication
1、 Relevant theories and tools of network security penetration testing
How to determine whether an array contains an element
如何避免 JVM 内存泄漏?
[microservice] Nacos cluster building and loading file configuration
采用中微BATG135实现IIC数据/指令交互
A little understanding of GSLB (global server load balance) technology
C realize Snake games
QT 获取随机颜色值设置label背景色 代码
APScheduler如何设置任务不并发(即第一个任务执行完再执行下一个)?
JS get the attribute values nested in the object
QT qtablewidget table column top requirements ideas and codes
Learning multi-level structural information for small organ segmentation
Which water in the environment needs water quality monitoring
Tsinghua University product: penalty gradient norm improves generalization of deep learning model
FRP intranet penetration, reverse proxy
Gridview出现滚动条,组件冲突,如何解决
Bicolor case
Yiwen unlocks Huawei's new cloud skills - the whole process of aiot development [device access - ESP end-to-side data collection [mqtt]- real time data analysis] (step-by-step screenshot is more detai
SQL join, left join, right join usage