Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int T[]={9,8,7,6,5,4,3,2,1,0}; //zmien tabliice
- int x;
- for(x=0;x<(sizeof(T)/sizeof(int));x++){
- printf("%d ", T[x]);
- }
- podprogram(&T,sizeof(T));
- printf("\n\n");
- for(x=0;x<(sizeof(T)/sizeof(int));x++){
- printf("%d ", T[x]);
- }
- return 0;
- }
- void swapS(int *a, int *b){
- int tmp = *b;
- *b=*a;
- *a=tmp;
- }
- void podprogram(int t[],int size){
- if(size%2==1)
- size-=1;
- int x;
- for(x=0;x<size-1;x=x+2){
- if(t[x]>t[x+1]){
- swapS(&t[x],&t[x+1]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement