View Code of Problem 78

#include <stdio.h>
#include <string.h>

int comp(const void* a, const void* b)
{
   char* c = (char*)a;
   char* d = (char*)b;
   return strcmp(c,d);
}


int main(void)
{
    char arr[3][100];
    int i;
    while(scanf("%s",arr[0]) != EOF)
    {
        scanf("%s%s",arr[1],arr[2]);
        qsort(arr,3,sizeof(char) * 100,comp);
        for(i = 0;i < 3;i++)
        printf("%s\n",arr[i]);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 78