#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#define MAX 50
typedef struct word_pair{
char longer_word[10];
char shorter_word[10];
char combined_word[20];
int longer_word_length;
int shorter_word_length;
}word_pair_t;
word_pair_t create_word_pair(char *a, char *b);
int main()
{
char a[MAX], b[MAX];
word_pair_t str;
str = create_word_pair(a, b);
printf("長い方の文字列[%s]\n",str.
longer_word); printf("短い方の文字列[%s]\n",str.
shorter_word); printf("連結した文字列[%s]\n",str.
combined_word); printf("長い方の文字列の長さ[%d]\n",str.
longer_word_length); printf("短い方の文字列の長さ[%d]\n",str.
shorter_word_length);
return 0;
}
word_pair_t create_word_pair(char *a, char *b)
{
word_pair_t str;
size_t lena, lenb;
int cmp;
if (lena == lenb) {
} else {
cmp = lena - lenb;
}
if (cmp > 0) {
} else if (cmp < 0) {
} else {
}
sprintf(str.
combined_word, "%s %s", str.
longer_word, str.
shorter_word); str.
longer_word_length = strlen(str.
longer_word); str.
shorter_word_length = strlen(str.
shorter_word);
return str;
}
I2RlZmluZSBfQ1JUX1NFQ1VSRV9OT19XQVJOSU5HUwoKI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KCiNkZWZpbmUgTUFYIDUwCgp0eXBlZGVmIHN0cnVjdCB3b3JkX3BhaXJ7CiAgY2hhciBsb25nZXJfd29yZFsxMF07CiAgY2hhciBzaG9ydGVyX3dvcmRbMTBdOwogIGNoYXIgY29tYmluZWRfd29yZFsyMF07CiAgaW50IGxvbmdlcl93b3JkX2xlbmd0aDsKICBpbnQgc2hvcnRlcl93b3JkX2xlbmd0aDsKfXdvcmRfcGFpcl90OwoKd29yZF9wYWlyX3QgY3JlYXRlX3dvcmRfcGFpcihjaGFyICphLCBjaGFyICpiKTsKCmludCBtYWluKCkKewoJY2hhciBhW01BWF0sIGJbTUFYXTsKCXdvcmRfcGFpcl90IHN0cjsKCglwcmludGYoIuaWh+Wtl+WIl+OCkjLjgaTlhaXlipvjgZfj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