69,371
社区成员
发帖
与我相关
我的任务
分享
char fun()
{
char c;
printf("please input:\n");
scanf("%c", &c);
if (c>='a'&&c<='z')
{
c = c - 32;
}
return c;
}
int main()
{
char ch1;
ch1 = fun();
printf("%c", ch1);
return 0;
}
int fun(char &c)
{
printf("please input:\n");
scanf("%c", &c);
if (c>='a'&&c<='z')
{
return 1;
}
return 0;
}
int main()
{
char ch1;
if (fun(ch1) == 1)
ch1 = ch1 - 32;
printf("%c",ch1);
return 0;
}
[/quote]谢谢 对了定义了也不对呀。c不是形参吗 [quote=引用 6 楼 datoulaile123 的回复:][quote=引用 2 楼 weixin_45934329 的回复:]
[quote=引用 1 楼 datoulaile123 的回复:]不是告诉你c没定义吗,main函数里你定义的不是ch1吗
char fun()
{
char c;
printf("please input:\n");
scanf("%c", &c);
if (c>='a'&&c<='z')
{
c = c - 32;
}
return c;
}
int main()
{
char ch1;
ch1 = fun();
printf("%c", ch1);
return 0;
}
int fun(char &c)
{
printf("please input:\n");
scanf("%c", &c);
if (c>='a'&&c<='z')
{
return 1;
}
return 0;
}
int main()
{
char ch1;
if (fun(ch1) == 1)
ch1 = ch1 - 32;
printf("%c",ch1);
return 0;
}
[/quote]谢谢 对了定义了也不对呀。c不是形参吗 [quote=引用 2 楼 weixin_45934329 的回复:]
[quote=引用 1 楼 datoulaile123 的回复:]不是告诉你c没定义吗,main函数里你定义的不是ch1吗
char fun()
{
char c;
printf("please input:\n");
scanf("%c", &c);
if (c>='a'&&c<='z')
{
c = c - 32;
}
return c;
}
int main()
{
char ch1;
ch1 = fun();
printf("%c", ch1);
return 0;
}
int fun(char &c)
{
printf("please input:\n");
scanf("%c", &c);
if (c>='a'&&c<='z')
{
return 1;
}
return 0;
}
int main()
{
char ch1;
if (fun(ch1) == 1)
ch1 = ch1 - 32;
printf("%c",ch1);
return 0;
}
定义了也不对呀。c不是形参吗 [quote=引用 1 楼 datoulaile123 的回复:]不是告诉你c没定义吗,main函数里你定义的不是ch1吗
那怎么调用函数 [quote=引用 3 楼 SuperDay 的回复:]你在main函数里面不能去用fun里面的参数
定义了也不对呀。c不是形参吗 不是告诉你c没定义吗,main函数里你定义的不是ch1吗
那怎么调用函数 你在main函数里面不能去用fun里面的参数
你在main函数里面不能去用fun里面的参数
不是告诉你c没定义吗,main函数里你定义的不是ch1吗