指针的C ++打印值 [英] C++ print value of a pointer
本文介绍了指针的C ++打印值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个双指针数组,但是每次我尝试打印其中一个值时,都会打印地址.如何打印实际值?
I have an array of double pointers, but every time I try do print one of the values the address gets printed. How do I print the actual value?
cout<< arr [i]吗? cout<< & arr [i]吗?他们都打印地址
cout << arr[i] ? cout << &arr[i] ? they both print the address
有人知道吗?
推荐答案
如果它确实是(初始化的)双指针数组,即:
If it's really an array of (initialized) double pointers, i.e.:
double *arr[] = ...
// Initialize individual values
您需要的是:
cout << *arr[i];
这篇关于指针的C ++打印值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文