www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/12/20/19:48:31

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: degoble AT gtech (David. E. Goble)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: *Newbie= Why isn't this small function working correctly?
Date: Thu, 20 Dec 2001 02:58:23 GMT
Organization: Gtech.Computing
Message-ID: <3c21516d.11484318@gtech>
References: <20011218200551 DOT 38218 DOT qmail AT web13907 DOT mail DOT yahoo DOT com>
X-Newsreader: Forte Free Agent 1.21/32.243
NNTP-Posting-Host: 203.48.5.176
X-Trace: 21 Dec 2001 11:10:31 +1050, 203.48.5.176
Lines: 36
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Tue, 18 Dec 2001 12:05:51 -0800 (PST), Chris Amos
<homie_dont_play_dat AT yahoo DOT com> wrote:
>
>void getstr(const char *string, const char *new_string, int
>start_offset, int end_offset);
>
Iam a newbe, so I may get somethings wrong.

Why declare the function then, define it, just have the function above
main.
>
>/**************************************************************************/
>void getstr(const char *string, const char *new_string, int
>start_offset, int end_offset)
>
Does declaring a const .... make the parameter readonly (ie
unchangable)???
>
>{
>  int i=0;
>  int b=0;
>
>  for (i=start_offset; i<=end_offset; i++) {
>    *(new_string+b)=string+i;
>    b++;
>  }
>  *(new_string+b)='\0';
>  return;
>
Syntax of return is return exp;

The function is declared to return void (ie it does not return
anything), so no need of return anyway.

Just my Aus 2 cents...

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019