#include<stdio.h>
#include<conio.h>
void pass(int);
void main()
{
int a=23;
int c;
clrscr();
pass(a);
printf(" %d ",c);
getch();
}
void pass( i)
{
//int i;
if(i>40)
return 1;
else
return 0;
}
bhallarahul -4 Light Poster
Recommended Answers
Jump to PostThat depends on what arun means.
Jump to PostI think "arun" means invoke undefined behavior. Because that's what the program does.
Jump to Posti ran that code on turbo c++ compiler and it ran successfully
I ran that code with my mental compiler (it's very forgiving) and it also ran successfully, but that doesn't mean the code is correct in any way, shape, or form. For example, my mental Lint wouldn't shut up.
Jump to PostAccording to the standards of 'C' language there is nothing written about a function cannot return which has return type void.
Any function which has void return type may not return value, but if we want we can return. Its not the compulsory condition.
But we should not assign the …
Jump to PostI want to how and why given program run?
Why don't you keep reading the standard? It has the answers:
A return statement with an expression shall not appear in a function whose return type is void.
Violation of a "shall" constraint invokes undefined behavior, which is defined as:
behavior, …
All 17 Replies
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Narue 5,707 Bad Cop Team Colleague
Kiss_and 0 Newbie Poster
bhallarahul -4 Light Poster
Narue commented: That's obvious. -4
Kiss_and 0 Newbie Poster
\007 7 Junior Poster in Training
bhallarahul -4 Light Poster
bhallarahul -4 Light Poster
Kiss_and 0 Newbie Poster
\007 7 Junior Poster in Training
bhallarahul -4 Light Poster
Narue 5,707 Bad Cop Team Colleague
\007 7 Junior Poster in Training
bajishareef -7 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
bhallarahul -4 Light Poster
Narue 5,707 Bad Cop Team Colleague
Salem commented: Well said +17
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.