编译器问题???
/*为什么下面的程序,在TC上没问题,在DEV C++中能通过编译而运行时有错误*/
#include <stdio.h>
#include <string.h>
#define N 20
void swap(char *p1, char *p2);
int main()
{
char *a[N], *b[N], *c[N];
printf("Pls input string:\n");
scanf("%s", a);
scanf("%s", b);
scanf("%s", c);
if(strcmp(a, b)>0)swap(a, b);
if(strcmp(b, c)>0)swap(b, c);
if(strcmp(a, c)>0)swap(a, c);
printf("after being sorted:\n");
printf(" %s\n %s\n %s\n", a, b, c);
system("pause");
return 0;
}
void swap(char *p1, char *p2)
{
char *temp;
strcpy(temp, p1);
strcpy(p1, p2);
strcpy(p2, temp);
}