/*************************************************************************
> File Name: strswap.c
> Author: Jam
> Mail: 13260888260@163.com
> Created Time: 2018年07月29日 星期日 09时19分46秒
************************************************************************/
#include<stdio.h>
#include<string.h>
#define row 3
#define list 20
void input ();
int main()
{
char str[row][list] = {"C++","Html","Java"};
char *p[row];
int i = 0;
int j = 0;
char *temp = NULL;
for(i = 0;i < row; i++)
{
p[i] = str[i];
}
for(i = 0; i < row-1; i++)//该处利用了选择排序
{
for(j = i+1; j < row; j++)
{
if(strcmp(p[i],p[j]))
{
temp = p[i];
p[i] = p[j];
p[j] = temp;
}
}
}
printf("str字符串数组中: ");
for(i = 0; i < row; i++)
{
printf("%s\t",str[i]);
}
printf("\n");
printf("p指针数组中: ");
for(i = 0; i < row; i++)
{
printf("%s\t",p[i]);
}
printf("\n");
return 0;
}