c语言调试问题,一下午了,求大神指点

#include
#include
int str(char *p1,char *p2)
{
int n;
int c;
if (strlen(p1)>=strlen(p2))
c=strlen(p1)-strlen(p2);
else n=strlen(p2);
for (int i=0;i<n;i++)
{

if (p1[i]!=p2[i])
{
c=p1[i]-p2[i];
break;}
else
{
c=0;

}
}
return (c);
}
void main()
{
char p1[100];
char p2[100];
gets(p1);
gets(p2);
char *p1=p1;
char *p2=p2;
str(*p1,*p2);
printf("%d",c);
}

int main()
{
    char p1[100];   
    char p2[100];
    gets(p1);
    gets(p2);
    char c = str(p1,p2);  //可以直接这样调用,并且定义一个c 接受返回值
    printf("%d",c);//此时可以打印c
}

warning:assignment makes pointer from integer without a cast

程序看起来问题比较多,,

就看main里面

(1)定义变量出现了重名的情况
前面定义了字符数组 p1,p2
后面又定义了 指向字符的指针 p1,p2

(2)函数具有作用域的概念,c是str函数里面,不在main函数中,
所以在main函数中打印会提示:c未定义的情况

看起来是C语言初学者吧,我也是C/C++过来的。可以关注一波~

str(*p1,*p2);把参数列表中的*去掉调用==>str(p1,p2);