title: C++ Program Apparently Printing Memory Address instead of Array
body: <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main(){
      int findMax(int *);
  
      const int MAX = 100;
      int values[MAX];
      char ivals[256];
      // Get the space-separated values from user input.
      cin.getline(ivals, 256, '0');
      char *helper;
      // Clean input array and transfer it to values.
      for(int i = 0; i &lt; (MAX) &amp;&amp; ivals[i] != 0; i++){
          helper = ivals[i * 2];
              values[i] = atoi(helper);
  
      }
  
      int mval = findMax(values);
      cout &lt;&lt; values &lt;&lt; endl &lt;&lt; mval;
      return 0;
  }
  //Function to find the maximum value in the array
  int findMax(int arr[]){
      int localmax = 0;
      for(int i = 0; i &lt; (sizeof(arr)/sizeof(int)); i++){
          if(arr[i] &gt; localmax){
              localmax = arr[i];
          }
      }
      return localmax;
  }
  </code></pre>
  
  <p>The purpose of this program is for the user to input a space-separated series of values ended by a 0. That array is then to be analyzed to find the max. I figured out how to convert what is originally a char[] into an int[] so that I can use the findMax() function on it without error but the sorting loop seems to have a problem of its own and when "cout &lt;&lt; values &lt;&lt; endl &lt;&lt; mval;" is called, it returns only a memory address instead of what should be a non-spaced sequence of ints. Can anybody explain what I am doing wrong? It seems that I may have made some mistake using the pointers but I cannot figure out what. </p>