#include<iostream> //#include<string> //#include<stdio.h> //using namespace std; void* test_i(){ int a = 1<<10; //int* pa = NULL; //Using the sign 'NULL' , it need to include iostream or stdio.h header files. //int* pa = &a; void* pa = &a; return pa; } int main(int argc, char* argv[]){ int count = 0; //int* ppa = test_i(); void* ppa = test_i(); int* pppa = (int*) ppa; std::cout<<ppa<<" "<pppa<std::endl; //std::cout<<"*ppa:"<<*ppa<<" *pppa:"<<*pppa<<std::endl; // this statement compiled error // 'void*' is not a pointer-to-object type std::cout<" *pppa:"<<*pppa<<std::endl; // outputs: *pppa:0 //printf("ppa = %p pppa=%p *ppa=%d *pppa=%d",ppa,pppa,0,*pppa); // error: 'void*' is not a pointer-to-object type so reverse the *ppa to zero // otherwise outputs are: // ppa = 000000000061FDB4 pppa=000000000061FDB4 *ppa=0 *pppa=1024 return 0; }