Re: Cannot return values of char variable
- From: "Pedro Pinto" <kubic62@xxxxxxxxx>
- Date: 3 Nov 2006 02:58:06 -0800
Ok, here it goes.
The problem is that i cannot, like in this example, return a char[]
correctly.
in this case i have do create a void function.
Although *array[] param keeps the alteration made to it i cannot do
this function with this signature:
char divide(char search_string[], char *array[], char *delimiter)
and return correctly the string.
Can you give me some tips on how i could return a string (or char
array) in this divide function?
Thank for all the help!
--------------------------------------------
void divide(char search_string[], char *array[], char *delimiter){
int loop;
array[0]=strtok(search_string,delimiter);
if(array[0]==NULL)
{
printf("No test to search.\n");
exit(0);
}
for(loop=1;loop<50;loop++)
{
array[loop]=strtok(NULL,delimiter);
if(array[loop]==NULL)
break;
}
for(loop=0;loop<50;loop++)
{
if(array[loop]==NULL)
break;
//printf("\nDivide - array[%d] = %s", loop,array[loop]);
}
}
.
- Follow-Ups:
- Re: Cannot return values of char variable
- From: Prasad
- Re: Cannot return values of char variable
- From: mark_bluemel
- Re: Cannot return values of char variable
- 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
- Cannot return values of char variable
- Prev by Date: Re: Error: 'for' loop initial declaration used outside c99 mode
- Next by Date: Re: Error: 'for' loop initial declaration used outside c99 mode
- Previous by thread: Re: Cannot return values of char variable
- Next by thread: Re: Cannot return values of char variable
- Index(es):
Relevant Pages
|
|