#include <stdio.h>
void SWAP(void*vp1, void*vp2, int size);
int main(void)
{
char *husband = strdup("Fred");
char *wife = strdup("Wilma");
SWAP(husband, wife, sizeof(char*)); //调用方式一:这种交换方式为什么不行?
SWAP(&husband, &wife, sizeof(char*)); //调用方式二:这种交换方式为什么在指针类型数据交换时有效?
一个内存数据交换的例子(一)
最新推荐文章于 2024-05-16 00:22:53 发布