Get two strings from the user and sort it as like words in dictionary using library function.
Implementation:
Implementation:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
char *s,*v;
/* Dynamically allocate memory for two strings */
s=(char*)malloc(sizeof(char));
v=(char*)malloc(sizeof(char));
/* Get the two strings as input from the user */
scanf("%s",s);
scanf("%s",v);
/* Compare the strings to check which is smaller & greater */
if(strcmp(s,v)<0)
{
printf("%s\n",s);
printf("%s\n",v);
}
else
{
printf("%s\n",v);
printf("%s\n",s);
}
return 0;
}