void reverse(char *str){
    char* end = str;
    char tmp;
    if(str){
        while(*end)
            ++end;
    }
    --end;
    /* swap characters from start of string with the end of the string, until the * pointers meet in middle. */
    while(str < end){
        tmp = *str;
        *str++ = *end;
        *end-- = tmp;
    }
}