[CSI] casting integer to pointer, C++ style

Mikhail Nesterenko mikhail at cs.kent.edu
Sun Jul 31 12:31:30 EDT 2016


CSI,

I promised to look up how to cast an interger to a pointer. Here is
the code:


   #include <iostream>
   int main(){

       int *p;
       // p = (int *)55;   // c-style
       p = reinterpret_cast<int *>(55);   // c++11 style

   }

Neither should be used for anything we are studying in CSI or CSII.

Thanks,
-- 
Mikhail


More information about the cs13001 mailing list