教えていただけると幸いです。
#include<stdio.h>
#define SIZE 100
unsigned str_copy(const char *ptsr1,const char *pstr2);
int main(void){
char str1[SIZE];
char str2[SIZE];
printf("文字列の入力>"); scanf("%s",str1);
str_copy(str1,str2);
printf("str1 : %s\n",str1);
printf("str2 : %s\n",str2);
return 0;
}
void str_copy(int pstr1,int pstr2){
do{
pstr1=pstr2;
pstr2++;
}while(pstr1=pstr2);
}
-----------------------------------------------
ex2201.c:24:6: error: conflicting types for 'str_copy'
void str_copy(int pstr1,int pstr2){
^
ex2201.c:7:10: note: previous declaration is here
unsigned str_copy(const char *ptsr1,const char *pstr2);
^
ex2201.c:30:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
}while(pstr1=pstr2);
~~~~~^~~~~~
ex2201.c:30:14: note: place parentheses around the assignment to silence this warning
}while(pstr1=pstr2);
^
( )
ex2201.c:30:14: note: use '==' to turn this assignment into an equality comparison
}while(pstr1=pstr2);
^
==
1 warning and 1 error generated.