输入3个字符串,按从小到大的顺序输出。要求使用指针的方法进行处理。

日期:2019-06-02 21:39:33 人气:1

输入3个字符串,按从小到大的顺序输出。要求使用指针的方法进行处理。

#include #include #include void swap(char **p1, char **p2) { char *temp; temp = *p1; *p1 = *p2; *p2 = temp; } int main() { char str[3][20], *p[3]; printf("请输入:\n"); for(int i = 0; i < 3; i++) { gets(str[i]); p[i] = str[i]; } for(int i
    A+
热门评论