size_t i = 0; while( cstring[i] ) { if( cstring[i] == '-' ) cstring[i] = '_'; i++; } #### char * temp = cstring; while( *temp ) { if( *temp == '-' ) *temp = '_'; temp++; }