#include <iostream>
#include <cstring>
void rev(const char* str)
{
char* p = new char[strlen(str) + 1];
for(int i = 0; str[i] != '\0'; i++)
{
p[i] = str[strlen(str) - i];
}
p[strlen(p) + 1] = '\0';
std::cout << p;
}
int main()
{
const char* s = "vBx";
rev(s);
}
What its wrong here ? it doesnt output.