07-27-2023, 12:05 PM
> **Possible Duplicate:**
> [Why can you return from a non-void function without returning a value without producing a compiler error?](
<!-- End of automatically inserted text -->
void main()
{
int y=0;
clrscr();
printf("%d\n",Testing());
y=Testing();
printf("%d",y);
getch();
}
int Testing()
{
int x=100;
//return x;
}
Result
512
4
i am not returning any thing from the testing function still value is coming?
Another Question also
void main()
{
char Testing();
int y=0;
clrscr();
printf("%d\n",Testing());
if(Testing())
printf("if--exi");
else
printf("else--exi");
getch();
}
char Testing()
{
char y;
//return y;
}
Result
0
if--exi
if printf is commented then result is
else--exi
why is it happening like that
> [Why can you return from a non-void function without returning a value without producing a compiler error?](
[To see links please register here]
)<!-- End of automatically inserted text -->
void main()
{
int y=0;
clrscr();
printf("%d\n",Testing());
y=Testing();
printf("%d",y);
getch();
}
int Testing()
{
int x=100;
//return x;
}
Result
512
4
i am not returning any thing from the testing function still value is coming?
Another Question also
void main()
{
char Testing();
int y=0;
clrscr();
printf("%d\n",Testing());
if(Testing())
printf("if--exi");
else
printf("else--exi");
getch();
}
char Testing()
{
char y;
//return y;
}
Result
0
if--exi
if printf is commented then result is
else--exi
why is it happening like that