It may be the compiler, but it just doesn't work. The program it's suppose to return the string "a m". [CODE] #include <iostream> #include <string> int main(int argc, char *argv[]) { std::string x = "hola mundo"; std::cout << fromto(x.c_str(),"l","u") << std::endl; return 0; } [/CODE] [CODE] const char* fromto(const char* str,const char* from,const char* to,bool include_from_and_to = true) { if(!MUO_char_from(str,from,include_from_and_to)){return "\0";} int x = MUO_char_to(str,from,to,include_from_and_to); if(x == 0){return "\0";} if(include_from_and_to){x += strlen(to);} char* res = new char[x]; int y = 0; for(;y < x;y++){res[y] = str[y];} res[y] = '\0'; return res; } [/CODE] [CODE] bool MUO_char_from(const char* &str,const char* &from,bool …

Member Avatar
Member Avatar
+0 forum 4

very simple, is there any speed or memory diference beetwen this two whiles? [CODE] int x = 0, y = 0; while(x < size) { y++; array[x] = array[y]; x++; } [/CODE] and [CODE] int x = 0; while(x < size) { array[x] = array[x++]; } [/CODE]

Member Avatar
Member Avatar
+0 forum 3

The End.