Re: Cannot return values of char variable
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Fri, 03 Nov 2006 18:24:42 GMT
"Pedro Pinto" <kubic62@xxxxxxxxx> writes:
{...]
I can do that inside main. What i can't do is with divide:
char divide(char search_string[], char *array[], char *delimiter)
and return the string you printed! Can this be done?
As others have mentioned multiple times, your divide() function returns
a single char value. It cannot return a string.
In general, a function cannot directly return a string or array; it
has to be done indirectly somehow. There are several ways to do this.
The comp.lang.c FAQ is at <http://www.c-faq.com/>. Read section 6,
"Arrays and Pointers".
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- Cannot return values of char variable
- From: Pedro Pinto
- Re: Cannot return values of char variable
- From: T.M. Sommers
- Re: Cannot return values of char variable
- From: Pedro Pinto
- Re: Cannot return values of char variable
- From: mark_bluemel
- Re: Cannot return values of char variable
- From: Pedro Pinto
- Re: Cannot return values of char variable
- From: Prasad
- Re: Cannot return values of char variable
- From: Pedro Pinto
- Cannot return values of char variable
- Prev by Date: Re: equivalent of chomp in perl
- Next by Date: Re: character byte str[i] treated as signed, I need unsigned
- Previous by thread: Re: Cannot return values of char variable
- Next by thread: Re: Cannot return values of char variable
- Index(es):
Relevant Pages
|
|