用c语言指针实现给整形数组冒泡排序
2016-06-23 16:18
309 查看
#include<stdio.h> void reverse(const int *start,const int *end) { int *tstart = start; while (start != end) { int *left = tstart; while (left != end) { if (*left > *(left + 1)) { *left = *left^*(left + 1); *(left + 1) = *left^*(left + 1); *left = *left ^ *(left + 1); left++; } else left++; } start++; } } int main() { int a[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; int len = sizeof(a) / sizeof(a[0]); reverse(a, a + len - 1); system("pause"); return 0; }
相关文章推荐
- 处理C++源代码的程序(2)
- 【C++】统计代码覆盖率(二)
- C++学习感想与总结
- 编写windows 服务(c++)
- 处理C++源代码的程序(1)
- C++类的自动转换
- C语言在子函数中调用malloc申请内存的方法
- C++中 explicit显示转换
- VS2010 C++ 操作Excel表格的编程实现
- c++ string问题 cout输出正常,printf输出乱码
- C++中memset函数用法详解
- 排序算法系列---简单选择排序(C++)
- 最值得关注的10个C开源项目和最全面的 C++ 资源、框架大全
- 多文件组成的c++课程设计学生管理系统(单链表)
- VIJOS-P1156
- Longest substring without repeat(C++)
- C++ 代码缩进
- c++读取txt文件到string
- 栈的链式 结构实现
- string 的简单实现