| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: [C] Return statement |
From: Bob Stout
On Fri, 9 Apr 2004, john dumas wrote:
> > > How is the return statement organized so that it does not need
> > > parentheses?
> > >
> > > return 1; // works
> >
> > Because it is a statement and not a function.
> >
> Can I make a statement, that works like a function?
> Any simple examples?
I'm not sure I understand what you're asking. From your example, you can
just as easily write...
return x;
...or...
return(x);
In either case, return is a statement, not a function. However, in the
second example, it looks like a function because the value it returns is
parenthesized. Perhaps the usage would be slightly clearer by using...
return (x);
Similarly...
if (condition)
...is a statement, not a function. The only difference is that the
parentheses aren't optional as they are for the return statement.
Perhaps it will help to simply remember that anything can be parenthesized,
whether necessary or not.
-------------------------------------------------------------
Consulting: http://www.MicroFirm.biz/ Web graphics development:
http://Image-Magicians.com/ Software archives:
http://snippets.snippets.org/
c.snippets.org/ cpp.snippets.org/ java.snippets.org/
d.snippets.org/ python.snippets.org/ perl.snippets.org/
dos.snippets.org/ embedded.snippets.org/ apps.snippets.org/
Audio and loudspeaker design:
http://LDSG.snippets.org/ http://www.diyspeakers.net/
--- BBBS/LiI v4.01 Flag-5
* Origin: Prism's_Point (1:261/38.1)SEEN-BY: 633/267 270 @PATH: 261/38 123/500 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.