c ++ 打印char指针_C ++程序打印不同类型的指针的大小以及值和地址

这篇博客介绍了如何在C++中使用sizeof()运算符来获取不同类型的指针变量(如整型、字符型、浮点型)的大小,并通过示例程序展示了在64位系统上指针变量的尺寸。同时,程序还打印出了这些指针所存储的地址及其对应的值类型。
摘要由CSDN通过智能技术生成

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;	
}


输出量 (Output

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值