i want to pass a string array to a function... or a struct array... but i can only pass one string and not all array... for example :
int g_player_id = 0;
STRING* g_player_name[50];
function main()
{
g_player_id++;
g_player_name[g_player_id] = str_create("Test_1_Player");
g_player_id ++;
g_player_name[g_player_id] = str_create("Test_2_Player");
f_print_name(g_player_id-1, g_player_name);
wait_for(f_print_name);
}
function f_print_name(int l_i, STRING* l_name)
{
printf("Player [ %i ] name is : %s", l_i, _chr( l_name ) );
printf("Player [ %i ] name is : %s", (l_i+1), _chr( l_name + 1 ) );
}
//------------------------------------------------------
/*
i use ( l_name + 1 ) because l_name is a pointer and somewhere i read that the l_name[1] and l_name[2]
i can write also as (l_name) and (l_name + 1)...
also i was tried with l_name[1] and l_name[2] but nothing... the result is empty ... (means that the string values cannot pass to function)...
the same problem i have with string thas is within a struct... i cannot pass a struct array to a function...
*/
//------------------------------------------------------
my target is to create a function that can take string arrays or Struct arrays ( with pointers only as i know ) , edit the values and send the result back or change the global value inside that function...
(Function-Command-Parameters like as C# :
stringarray = somestring.split('-');
a function that splits a string and return the result into an array of strings... )
my function must take the array from user such as :
f_split( STRING* l_str_to, STRING* l_str_from, char* l_char_to_split);
or
STRING* l_str_to[100];
l_str_to = f_split(STRING* l_str_from, char* l_char_to_split);
//------------------------------------------
but my problem is that i cannot also pass and struct arrays... :-(
thx you all... (and sorry for my english).
Best Regards.
Dimitris.
Last edited by NeoJT; 04/11/13 19:00.