本文介绍了使用int时为什么没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了int fun(intx),但为什么它没有显示错误,因为返回值不是int.infact类型,当我使用char代替int时它显示错误。
我的尝试:
i have used int fun(intx) but why it is not showing error as return value is not of type int.infact when i am using char in place of int it is showing error.
What I have tried:
#include<stdio.h>
int main()
{
int n,i;
printf("enter n\n");
scanf("%d",&n);
fun(n);
}
int fun(int x)
{int i;
char c='*';
if(x>=1)
{for(i=1;i<=x;i++)
printf("%c",fun(x-1));}
else
return c;
}
推荐答案
这篇关于使用int时为什么没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!