how to print address of variable in cpp code example Example: c++ print variable address printf("%p\n",(void*)&a);