Home >>Cpp Programs >C++ Program for Print address of Variable Using Pointer
In this example, we will see a C++ program through which we can print the size of different types of pointers along with values.
In this program, we will use the sizeof() operator to get the size of the variables.
Program:
#include <iostream>
using namespace std;
int main()
{
int *iptr;
char *cptr;
float *fptr;
cout<<sizeof(iptr)<<","<<sizeof(cptr)<<","<<sizeof(fptr)<<endl;
cout<<sizeof(*iptr)<<","<<sizeof(*cptr)<<","<<sizeof(*fptr)<<endl;
return 0;
}