![](/media/cache/profiles/perfil.jpeg.50x50_q85.jpg)
qsort, descripcion y ejemplo
Revision 0:b011c638604b, committed 2012-04-03
- Comitter:
- sherckuith
- Date:
- Tue Apr 03 21:02:30 2012 +0000
- Commit message:
- qsort, descripcion y ejemplo
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r b011c638604b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Apr 03 21:02:30 2012 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" +/* qsort example */ +#include <stdio.h> +#include <stdlib.h> + +int values[] = { 40, 10, 100, 90, 20, 25 }; + +int compare (const void * a, const void * b) +{ + return ( *(int*)a - *(int*)b ); +} + +int main () +{ + int n; + qsort (values, 6, sizeof(int), compare); + for (n=0; n<6; n++) + printf (": %d ",values[n]); + return 0; +} \ No newline at end of file
diff -r 000000000000 -r b011c638604b mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Apr 03 21:02:30 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479