Re: First program in C - what is going on with function returns?
- From: ben.carbery@xxxxxxxxx
- Date: 30 Apr 2006 20:03:42 -0700
Ok, that does the trick.
I have now moved the program to a linux system which was a bit fussier.
I cleaned up a bit by removing any global vars and making proper use of
function returns.
The program is compiling ok but I receive this warning:
daysalive.c: In function `speakdate':
daysalive.c:92: warning: function returns address of local variable
Is this a problem? Relevant code below.
char *speakdate(int d, int m, int y)
{
<snip>
return datestring;
}
int main(void)
{
<snip>
printf ("Your date of birth is
%s\n\n",speakdate(bdate,bmonth,byear));
<snip>
printf ("The current date is:
%s\n\n",speakdate(cdate,cmonth,cyear));
<snip>
}
.
- Follow-Ups:
- Prev by Date: Re: Trying to read hardware memory from pointer?
- Next by Date: Re: discussing C evolution
- Previous by thread: Re: First program in C - what is going on with function returns?
- Next by thread: Re: First program in C - what is going on with function returns?
- Index(es):
Relevant Pages
|