c_cpp void *指针的转换问题,这里C和C ++有差别

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp void *指针的转换问题,这里C和C ++有差别相关的知识,希望对你有一定的参考价值。

#include <iostream>
using namespace std;

void* pvoid;
int* pint;
int* pint2;

int main() {
	int a = 5;
	
	pint = &a;
	cout << a << '\t' << pint << '\t' << *pint << endl;
	
	pvoid = pint;
	pint2 = (int*) pvoid;
	cout << a << '\t' << pint2 << '\t' << *pint2 << endl;
	
	
	// your code goes here
	return 0;
}

以上是关于c_cpp void *指针的转换问题,这里C和C ++有差别的主要内容,如果未能解决你的问题,请参考以下文章