Language: C++

#include<iostream>

#define     MAX_LENGTH     10000
#define     MAX_WORDS      22

using namespace std;

int compstr(const char *,const char *,const unsigned int);
int swapstr(char *,char *,const unsigned int);

int main(){
	int n,i;
	char strs[MAX_LENGTH][MAX_WORDS];
	bool flag;

	// 文字列数の入力
	cin >> n;
	if((n <= 0) || (n > MAX_LENGTH)){
		cerr << "Error!!" << endl;
		return -1;
	}

	// 文字列の入力
	for(i=0;i<n;i++){
		cin >> strs[i];
	}

	// 辞書式順列に並び替える
	do{
		flag = false;
		for(i=0;i<(n - 1);i++){
			if(compstr(strs[i],strs[i+1],(((int)MAX_WORDS) - 2)) == -1){
				swapstr(&strs[i][0],&strs[i+1][0],(((int)MAX_WORDS) - 2));
				flag = true;
			}
		}
	}while(flag == true);

	// 一番最初の文字列を出力
	cout << strs[0] << endl;

	return 0;
}

// 辞書式順列判定関数
// str_a < str_b のとき 1
// str_a = str_b のとき 0
// str_a > str_b のとき -1
int compstr(const char *str_a,const char *str_b,const unsigned int num){
	int i;

	for(i=0;i < ((int)num);i++){
		if(*((char *)(((int)str_a) + i)) > *((char *)(((int)str_b) + i))){
			return -1;
		}else if(*((char *)(((int)str_a) + i)) < *((char *)(((int)str_b) + i))){
			return 1;
		}else if((*(str_a)) == '\0'){
			return 0;
		}
	}

	return 0;
}

// 文字列交換関数
// str_a と str_b の最初の n 文字を交換します
int swapstr(char *str_a,char *str_b,const unsigned int n){
	char str_buf[MAX_WORDS];
	int i;

	// buf <- str_a
	for(i=0;i < ((int)n);i++){
		str_buf[i] = *((char *)(((int)str_a) + i));
	}

	// stra <- str_b
	for(i=0;i < ((int)n);i++){
		*((char *)(((int)str_a) + i)) = *((char *)(((int)str_b) + i));
	}

	// str_b <- buf
	for(i=0;i < ((int)n);i++){
		*((char *)(((int)str_b) + i)) = str_buf[i];
	}

	return i;
}

Compiler output:
a.cc: In function 'int compstr(const char*, const char*, unsigned int)':
a.cc:53:32: error: cast from 'const char*' to 'int' loses precision [-fpermissive]
   53 |                 if(*((char *)(((int)str_a) + i)) > *((char *)(((int)str_b) + i))){
      |                                ^~~~~~~~~~
a.cc:53:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   53 |                 if(*((char *)(((int)str_a) + i)) > *((char *)(((int)str_b) + i))){
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:53:64: error: cast from 'const char*' to 'int' loses precision [-fpermissive]
   53 |                 if(*((char *)(((int)str_a) + i)) > *((char *)(((int)str_b) + i))){
      |                                                                ^~~~~~~~~~
a.cc:53:54: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   53 |                 if(*((char *)(((int)str_a) + i)) > *((char *)(((int)str_b) + i))){
      |                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:55:38: error: cast from 'const char*' to 'int' loses precision [-fpermissive]
   55 |                 }else if(*((char *)(((int)str_a) + i)) < *((char *)(((int)str_b) + i))){
      |                                      ^~~~~~~~~~
a.cc:55:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   55 |                 }else if(*((char *)(((int)str_a) + i)) < *((char *)(((int)str_b) + i))){
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:55:70: error: cast from 'const char*' to 'int' loses precision [-fpermissive]
   55 |                 }else if(*((char *)(((int)str_a) + i)) < *((char *)(((int)str_b) + i))){
      |                                                                      ^~~~~~~~~~
a.cc:55:60: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   55 |                 }else if(*((char *)(((int)str_a) + i)) < *((char *)(((int)str_b) + i))){
      |                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int swapstr(char*, char*, unsigned int)':
a.cc:73:42: error: cast from 'char*' to 'int' loses precision [-fpermissive]
   73 |                 str_buf[i] = *((char *)(((int)str_a) + i));
      |                                          ^~~~~~~~~~
a.cc:73:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   73 |                 str_buf[i] = *((char *)(((int)str_a) + i));
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:78:29: error: cast from 'char*' to 'int' loses precision [-fpermissive]
   78 |                 *((char *)(((int)str_a) + i)) = *((char *)(((int)str_b) + i));
      |                             ^~~~~~~~~~
a.cc:78:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   78 |                 *((char *)(((int)str_a) + i)) = *((char *)(((int)str_b) + i));
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:78:61: error: cast from 'char*' to 'int' loses precision [-fpermissive]
   78 |                 *((char *)(((int)str_a) + i)) = *((char *)(((int)str_b) + i));
      |                                                             ^~~~~~~~~~
a.cc:78:51: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   78 |                 *((char *)(((int)str_a) + i)) = *((char *)(((int)str_b) + i));
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:83:29: error: cast from 'char*' to 'int' loses precision [-fpermissive]
   83 |                 *((char *)(((int)str_b) + i)) = str_buf[i];
      |                             ^~~~~~~~~~
a.cc:83:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   83 |                 *((char *)(((int)str_b) + i)) = str_buf[i];
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~