Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int cmpfunc(const void* a, const void* b) {
- return *(char*)a - *(char*)b;
- }
- void AlphabetSort(char str[]) {
- qsort(str, (size_t)strlen(str), (size_t) sizeof(char), cmpfunc);
- }
- char** commonChars(char** A, int ASize, int* returnSize) {
- int i;
- //char* ch_arr1 = malloc(sizeof(char) * 10);
- for (i = 0; i < ASize; i++) {
- printf("%d: %s\n", i, A[i]);
- AlphabetSort(A[i]);
- printf("%s\n", A[i]);
- //strcpy_s(ch_arr1, 5, A[i]);
- //AlphabetSort(ch_arr1);
- //printf("%s\n", ch_arr1);
- }
- }
- int main() {
- char* words[] = {
- "cool",
- "lock",
- "cook",
- };
- int returnedSize = 0;
- char** rwords = NULL;
- rwords = commonChars(words, 3, &returnedSize);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement