title: Calling a device function from global function
body: <p>How should I acces 'do_sth' function in 'print' function (look at the code)? Why there is 'N' (look at the code) variable/constant visible to GPU without using cudaMemcpy?</p>
  
  <pre><code> __device__ void do_sth(char *a, int N)
   {
           int idx = blockIdx.x * blockDim.x + threadIdx.x;
           if(idx &lt; N)
           {       
                   a[idx] = a[idx]; 
           }
   }
  
  
   __global__ void print(char *a, int N) 
   {     
           //question_1: why there is an access to N, it is now in GPU memory, how?
           int idx = blockIdx.x * blockDim.x + threadIdx.x;
  
           //do_sth&lt;&lt;&lt;nblock2,blocksize2&gt;&gt;&gt;(a,N); //error_1: a host function call can not be configured
           //do_sth(&amp;&amp;a,N); //error_2: expected an expression
  
           if(idx&lt;N)
           {       
                   a[idx]=a[idx];
           }
   }
  </code></pre>