title: Dynamic pointer reference array return value by a ternary operator with exception
body: <p>I am learning about pointers, references, return values, and ternary operators. </p>
  
  <p>I am trying to use a <strong><em>pointer to reference</em></strong> correctly for a dynamic array through the use of the parameter <code>int *&amp;A</code>, without returning a newly created array. I strictly want to copy the array from the main loop, and set the size, if it fails to allocate throw an error.</p>
  
  <p>Is this the correct way to go about this: </p>
  
  <pre><code>int
  *_resize(int *&amp;A, int s)
  {
    try {
        return A = new int[s] == (nullptr) ? throw std::bad_alloc() : A;
    } catch (...) {
      std::cout &lt;&lt; "H" &lt;&lt; std::endl;
    }
  
  }
  int main()
  {
    int *A;
    A = _resize (A, 1000000005546456456ul); // Test
  }
  </code></pre>
  
  <p>Should I be using <code>(std::nothrow)</code> also:</p>
  
  <pre><code>return A = new (std::nothrow) int[s]
  </code></pre>