Created
November 23, 2011 15:10
-
-
Save pasali/1388914 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<string.h> | |
void bol(int *p, int pivot) | |
{ | |
char a[50]; | |
char b[50]; | |
int i = 0,j = 0; | |
while( *p != '\0' ) | |
{ | |
if (*p < pivot) | |
{ | |
a[j] = *p; | |
j++; | |
} | |
else if (*p > pivot) | |
{ | |
b[i] = *p; | |
i++; | |
} | |
p++; | |
} | |
a[strlen(a)-1] = pivot; | |
char *x =b; | |
while(*x != '\0') | |
{ | |
a[j] = *x; | |
x++; | |
j++; | |
} | |
char *t = a; | |
while( *t != '\0') | |
{ | |
printf("%d\n", *t); | |
t++; | |
} | |
} | |
int main() | |
{ | |
int dizi[] = {1,2,34,23,5,41,78}; | |
bol(dizi,23); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment