title: How to initialize array of integer kind 8 in fortran?
body: <p>I want to initialize an array of large integers in fortran, I have tried:</p>
  
  <pre><code>integer(kind=8) :: XGrid(1:20)
  </code></pre>
  
  <p>But the integers remain the default kind=4. As I later add numbers to the array:</p>
  
  <pre><code>XGrid = (/3002, 3340403,....,19460630000/)
  </code></pre>
  
  <p>And I receive a "This numeric constant is out of range" error. As it wont fit in a kind=4 int, but will in a kind=8 int.</p>
  
  <p>I have also tried declaring it as:</p>
  
  <pre><code>integer, parameter :: ik8 = selected_int_kind(8) 
  integer(ik8) :: XGrid(1:20)
  </code></pre>
  
  <p>But this also did not work.</p>
  
  <p>Edit:
  Thanks Vladimir F, but I am trying to define an array rather than just a single variable and as such I cant understand how to adapt the answer used in:
  <a href="https://stackoverflow.com/questions/6146005/is-there-a-better-double-precision-assignment-in-fortran-90">Is There a Better Double-Precision Assignment in Fortran 90?</a>
  Would it be:</p>
  
  <pre><code>integer, parameter :: ik8 = selected_int_kind(8) 
  integer(ik8) :: XGrid(1:20)_ik8
  XGrid = (/3002_ik8, 3340403_ik8,....,19460630000_ik8/)
  </code></pre>
  
  <p>or is it different? Thanks</p>