c ++ 打印char指针
Here, we will learn how we can print the size of different type of pointer variables in c++ programming language?
在这里,我们将学习如何在c ++编程语言中打印不同类型的指针变量的大小?
We are using sizeof() operator to get the size of variables.
我们正在使用sizeof()运算符来获取变量的大小。
Consider the following 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;
}