Re: First program in C - what is going on with function returns?
- From: "Herbert Rosenau" <os2guy@xxxxxxxxxxxxx>
- Date: Sun, 30 Apr 2006 19:16:33 +0000 (UTC)
On Sun, 30 Apr 2006 12:02:11 UTC, ben.carbery@xxxxxxxxx wrote:
int main(void)
on a related note, is there a difference between "int main (void)" and
"int main ()" ?
Yes. int main(void) declares a function returning nothing and having
no parameters. int main() declares a function returning nothing and
having an unspecified number of parameters of unspecified types.
speakdate(), as written, returns nothing, so treating it as if it does is
an error. That you get any output at all is simply a matter of accident.
should be able to fix this if i can return an array.
There is no need to return an array. Return a pointer to the string
you've builded already is all you needs. The string should not be an
auto variable becauser that will get indertimine with the return
statement. But using either a static array, a malloced memory area
(the calle would be required to free() it) or extern or at file scope.
--
Tschau/Bye
Herbert
Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
.
- References:
- First program in C - what is going on with function returns?
- From: ben . carbery
- Re: First program in C - what is going on with function returns?
- From: Kelsey Bjarnason
- Re: First program in C - what is going on with function returns?
- From: ben . carbery
- First program in C - what is going on with function returns?
- Prev by Date: Re: First program in C - what is going on with function returns?
- Next by Date: Re: Casting void * to void ** ?
- Previous by thread: Re: First program in C - what is going on with function returns?
- Next by thread: Question about (double *)NULL
- Index(es):
Relevant Pages
|