大连网站搭建与推广,上海外包公司网站建设,网站关键字收录,应用分析网站swab函数交换字符串中相邻两个字节#xff1b;
void _swab( char *src, char *dest, int n ); char *src#xff1a; 要拷贝、转换的字符串#xff0c; char *dest#xff0c;转换后存储到dest所表示的字符串#xff0c; int n要拷贝、转换的字节数#xff1b;
所… swab函数交换字符串中相邻两个字节
void _swab( char *src, char *dest, int n ); char *src 要拷贝、转换的字符串 char *dest转换后存储到dest所表示的字符串 int n要拷贝、转换的字节数
所属库是 stdlib.h
VC里面可以直接用
void CMyswabView::OnDraw(CDC* pDC)
{CMyswabDoc* pDoc GetDocument();ASSERT_VALID(pDoc);// TODO: add draw code for native data herechar* hello ABCDMN;char temp[32];memset(temp, 0, sizeof(temp));swab(hello, temp, strlen(hello));pDC-TextOut(50, 50, temp);swab(temp, temp, strlen(temp));pDC-TextOut(50, 80, temp);
}
字符串一开始是 ABCDMN交换之后输出再交换又输出