Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ generic pointer

void*  gp;    //generic pointer
int*  ip;     //int pointer
char*  cp;    //char pointer

gp = ip;      //legal conversion
ip = static_cast<int*>(gp); //explicit cast required
                            //in C++ but not in C
cp = ip;      //illegal conversion
*ip = 15;     //legal dereference of pointer to int
*ip = *gp;    //illegal generic pointer dereference
Source by www.ooportal.com #
 
PREVIOUS NEXT
Tagged: #generic #pointer
ADD COMMENT
Topic
Name
6+1 =