i am trying to make a program that inserts to an 'char** arr' a char pointer and then sort the char pointers with strcmp but for some reason its just don't work, the code i added is the sorting part of the entire code.
do
{
flag = 0;
for (i = 0; i < num - 1; i++)
{
if ((strcmp(arr[i], arr[i + 1])) < 0)
{
flag = 1;
temp = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = temp;
}
else if ((strcmp(arr[i], arr[i + 1])) > 0)
{
flag = 1;
temp = arr[i + 1];
arr[i + 1] = arr[i];
arr[i] = temp;
}
else if ((strcmp(arr[i], arr[i + 1])) == 0)
{
flag = 1;
continue;
}
}
} while (flag == 1);