Advertisement
smatskevich

StrRevert

Apr 17th, 2021
891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int main() {
  4.   const char* c = "hi";
  5.   int n = 2;
  6.  
  7.   char* s = new char[n];
  8.  
  9.   for (int i = 0; i < n; ++i)
  10.     s[n - 1 - i] = c[i];
  11.   std::cout << s;
  12.  
  13.   delete[] s;
  14.   return 0;
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement