bryan.6
06-11-2004, 08:57 AM
what i want to do is modify an array of strings within a function.
this code works:
char string[255];
int testing( char* t ) {
strcpy( t, "test succeeded" );
}
int main( void ) {
testing( string );
printf( "string: %s\n", string )
}
but this code doesn't:
char string[1][255];
int testing( char** t ) {
strcpy( t[0], "test succeeded" );
}
int main( void ) {
testing( string );
printf( "string: %s\n", string[0] )
}
obviously this is just a simple example, but i want to modify an array of strings in a function. Does anybody have any idea what i'm going to have to do to make this work?
this code works:
char string[255];
int testing( char* t ) {
strcpy( t, "test succeeded" );
}
int main( void ) {
testing( string );
printf( "string: %s\n", string )
}
but this code doesn't:
char string[1][255];
int testing( char** t ) {
strcpy( t[0], "test succeeded" );
}
int main( void ) {
testing( string );
printf( "string: %s\n", string[0] )
}
obviously this is just a simple example, but i want to modify an array of strings in a function. Does anybody have any idea what i'm going to have to do to make this work?