C
문자열 뒤집기(포인터 사용)
시연이아빠
2020. 3. 12. 17:41
#include <iostream>
using namespace std;
int main()
{
char a[] = "leeseungwoo";
char* first = (char*)a;
char* last = (char *)a + strlen(a) -1;
while (first < last)
{
char temp = *first;
*first = *last;
*last = temp;
first++;
last--;
}
cout << a << endl;
}