Help, wrote a program to sort the string alphabetically. How can you alter the string to be entered, the head no longer cooks.
#include <stdio.h> #include <stdlib.h> void sort(char **words,int size) { int n,m,code; char *temp; for(n=1; n<size; n++) for(m=0; m<size-n; m++) { code=strcmp(words[m],words[m+1]); if(code>0) { temp=words[m]; words[m]=words[m+1]; words[m+1]=temp; } } for (n = 0; n < size; n++) printf("%s ",words[n] ); } int main() { char *words []= {"fake","bus","atom"}; int size =sizeof(words)/sizeof(char*); sort(words,size); }