Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdlib.h>
- char **lexifirst( char *tt[], int sor, int oszlop )
- {
- char **p = malloc( oszlop * sizeof( char * ) );
- int i, j;
- for ( j = 0; j < oszlop; ++j )
- {
- int min_index = 0;
- for ( i = 1; i < sor; ++i )
- if ( strcmp( tt[ i * oszlop + j ], tt[ min_index * oszlop + j ] ) < 0 )
- min_index = i;
- p[j] = malloc( (strlen( tt[ min_index * oszlop + j ] ) + 1) * sizeof (char));
- strcpy( p[j], tt[ min_index * oszlop + j] );
- }
- return p;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement