Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void reverse (char* str) {
- char* newStr = (char*)malloc(sizeof(str));
- for (int i=0;i<sizeof(str)/sizeof(char);i++) {
- int index = sizeof(str)/sizeof(char)-1-i;
- newStr [i] = str [index];
- }
- }
- void reverse (char* str) {
- size_t len = strlen(str);
- char* newStr = (char*)malloc(len + 1);
- for (int i=0; i<len;i++) {
- int index = len-1-i;
- newStr[i] = str[index];
- }
- newStr[len] = '