strcpy在gcc下的兼容问题,提示:“passing argument 1 of ‘strcpy’ from incompatible pointer ty
											 下面这段代码,用cmake运行正常,用gcc运行出错,请诸位高手告知如何才能跟gcc兼容: 程序代码:
程序代码:/**
 * 【程序79】
 * 题目:字符串排序。
 */
#include <stdio.h>
#include <string.h>
char swap(p1, p2)
        char *p1, *p2;
{
    char *p[200];
    strcpy(p, p1);
    strcpy(p1, p2);
    strcpy(p2, p);
}
int main() {
    char *str1[200], *str2[200], *str3[200];
    char swap();
    printf("please input three strings\n");
    scanf("%s", str1);
    scanf("%s", str2);
    scanf("%s", str3);
    if (strcmp(str1, str2) > 0) {
        swap(str1, str2);
    }
    if (strcmp(str1, str3) > 0) {
        swap(str1, str3);
    }
    if (strcmp(str2, str3) > 0) {
        swap(str2, str3);
    }
    printf("after being sorted\n");
    printf("%s\n%s\n%s\n", str1, str2, str3);
    return 0;
}在线调试地址:https://www.bccn.net/run/95944



 
											





 
	    

 
	
 
											
 ,已编译通过
,已编译通过										
					
	
