TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:10364] returning a value from an array



This is starting to sound like a homework assignment that we're doing for
you.  You should be able to figure this one out.

On Mon, 22 Nov 1999, bliss wrote:

> ok now i need this function to return a value that is in the array
> char *array[30] = {0};
> char *server_c;
> char item_chossen[5];
> int temp;
> 
> /* my fgets that reads from a file and puts the strings into the array goes
> here */
> printf("which on do you want\n");
> 1 string1
> 2 string2
> .....
> scanf("%s", &item_chossen);
> temp = atoi(item_chossen);
> /* i want to return the value in arry[temp - 1] to the calling function */
> server_c = &array[(temp - 1)];
> return server_c;
> this does not work; i get warning: assignment from incompatible pointer w/o
> a cast
> warning: return makes integer from pointer w/o a cast
> the function is set
> char funtion();
> so i hope this is enough to show you where i am missing the boat.....
> 
> i have just never thought to return a value in an array before.
> TIA
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-list-help@mn-linux.org
> 

-- 
Jon Schewe 
http://eggplant.mtu.net/~jpschewe
schewe@tcfreenet.org