当前位置:网站首页>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,
边栏推荐
- Manually page the list (parameter list, current page, page size)
- Notes and notes
- Is the insurance annuity product worth buying? Is there a hole?
- C實現貪吃蛇小遊戲
- ES6 模块化
- Tsinghua University product: penalty gradient norm improves generalization of deep learning model
- Invalid revision: 3.18.1-g262b901-dirty
- Internet of things protocol ZigBee ZigBee module uses the concept of protocol stack
- Learning multi-level structural information for small organ segmentation
- AWT common components, FileDialog file selection box
猜你喜欢
High performance parallel programming and optimization | lesson 02 homework at home
How to solve the component conflicts caused by scrollbars in GridView
C实现贪吃蛇小游戏
How to get the parent node of all nodes in El tree
体验碎周报第 102 期(2022.7.4)
509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费
Cloud native - SSH article that must be read on the cloud (commonly used for remote login to ECS)
SQL join, left join, right join usage
The end of the Internet is rural revitalization
Gridview出现滚动条,组件冲突,如何解决
随机推荐
C實現貪吃蛇小遊戲
剑指 Offer II 038. 每日温度
AWT introduction
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
px em rem的区别
[openvino+paddle] paddle detection / OCR / SEG export based on paddle2onnx
QT 获取随机颜色值设置label背景色 代码
Leetcode question brushing record | 206_ Reverse linked list
Gridview出现滚动条,组件冲突,如何解决
[March 3, 2019] MAC starts redis
JS execution mechanism
Webrtc quickly set up video call and video conference
HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
Matlab remainder
每周小结(*63):关于正能量
High performance parallel programming and optimization | lesson 02 homework at home
Which water in the environment needs water quality monitoring
[microservice] Nacos cluster building and loading file configuration
MySQL learning notes 3 - JDBC
如何实现视频平台会员多账号登录