C++ print value of a pointer

43,404

Solution 1

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

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

all you need is:

cout << *arr[i];

Solution 2

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

Solution 3

cout << *(arr[i]);

Share:
43,404
user69514
Author by

user69514

Updated on March 21, 2020

Comments

  • user69514
    user69514 about 4 years

    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?