문제

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] ? they both print the address

Does anyone know?

도움이 되었습니까?

해결책

If it's really an array of (initialized) double pointers, i.e.:

double *arr[] = ...
// Initialize individual values

all you need is:

cout << *arr[i];

다른 팁

cout << *(arr[i]) will print the value.

cout << *(arr[i]);

If "arr" is declared as

double* arr[..];

Then you would use:

cout << *(arr[i])
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top