www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/25/21:42:59

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help Me!
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <digcgs84t2nvlt2amo4nfmtmh7ufnad737@4ax.com>
References: <8e045l$6pc$1 AT agate DOT berkeley DOT edu> <3903CFA2 DOT ECC9D671 AT yahoo DOT com> <8e416n$v2j$1 AT nnrp1 DOT deja DOT com>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 36
X-Trace: /bCCZGf+BBe+8JHQ9eOP0HKwYISSu+29msXfnk2uWrWM0ZWyXBMshwWUTLKqy8Vqk/bFO3fcVbXh!yc1Ucd7yt4okSiRrGQGxxM71e74YrNN1iTIiaUaT5uP5L29H/tT8pK+DOnVsTbfgbOCuvAv3JpPF!USP919E=
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Wed, 26 Apr 2000 01:14:40 GMT
Distribution: world
Date: Wed, 26 Apr 2000 01:14:40 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Tue, 25 Apr 2000 11:57:14 GMT, ahj372 AT my-deja DOT com wrote:

>I can't seem to figure out how to get a function
>to return an array of characters. For instance:
>
>char string()
>{
>return "This never works!!!";
>}

You have to pass the array as a pointer.

#include <stdio.h>
#include <string.h>

void string(char *str)
{
  strcpy(str, "Hello World");
}

int main()
{
  char hello[256];

  string(hello);
  puts(hello);
  return 0;
}

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


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