Condition: "A string consists of words separated by one or more spaces. Rearrange the words in alphabetical order." I managed to do without gaps. But still this is not something, please help.
#include <stdlib.h> #include <string.h> #include <stdio.h> #define N 100 #define M 30 int main(int argc, char* argv[]) { char a[N][M] = { "privet", "menia", "zovyt", "Vladislav" }; int n, i; n = 1; qsort(a, n, sizeof(char[M]), (int(*)(const void *, const void *)) strcmp); for (i = 0; i < n; i++) printf("%s\n", a[i]); return 0; }