#include <stdio.h>
#include <unistd.h>
void print(char *s)
{
if (*s)
{
write (1, s, 1);
print(s + 1);
}
}
int ft_strcmp(char *s1, char *s2)
{
int i;
i = 0;
while (s1[i] || s2[i])
{
if (s1[i] != s2[i])
return (s1[i] - s2[i]);
i++;
}
return (0);
}
void ft_swap(char *a, char *b)
{
char temp;
temp = *a;
*a = *b;
*b = temp;
}
int main(int argc, char *argv[])
{
int i;
i = 1;
while (i < argc)
{
int j = i + 1;
while (j < argc)
{
if (ft_strcmp(argv[j], argv[j + 1]) > 0)
{
ft_swap(argv[j], argv[j + 1]);
}
j++;
}
i++;
}
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: