Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int _sort(int *p, int n);
- ////////////////////////////////////////////////////
- int main() //
- {
- int nArr[100] = {22, 11, 54, 9, 2, 66, 1111, 333, 77, 993, 5, 7, 8, 1, 444, 59};
- int nSize = 16;
- _sort(nArr, nSize);
- for(int i = 0; i < nSize; i++) printf("%d, ", nArr[i]);
- printf("\n ");
- }
- ////////////////////////////////////////////////////
- int _sort(int *p, int n)
- {
- int i = 0,
- x = 0;
- for(; i < n-1; i++)
- {
- if(p[i] > p[i+1])
- {
- x = p[i];
- p[i] = p[i+1];
- p[i+1] = x;
- }
- }
- for(i = 0; i < n-1; i++)
- {
- if(p[i] > p[i+1])
- {
- x = p[i];
- p[i] = p[i+1];
- p[i+1] = x;
- }
- }
- for(i = 0; i < n-1; i++)
- {
- if(p[i] > p[i+1])
- {
- x = p[i];
- p[i] = p[i+1];
- p[i+1] = x;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement