calling a __device__ routine with address of a local variable

I have the following example code
It is called on a block of 1 with 4 thread as an example.

The contents of a always seem to be zero. From an automatic variable in local space, can you call a
a device with one of the parameters being the address of a local variable?

Thanks in advance and see code below for example.

RalphB
device uint32_t calculate(int *a)
{
printf(“address of a=%d\n”,*a);
return 0;

}

global void loop1(unsigned int a)
{
int a[16];
int i;
int threadidx= threadIdx.x

            for (i=0;i<16;i++)
            {
                a[i]=i+threadidx;
            }
             printf("threadidx=%d\n",threadidx);
             calculate(a[threadidx]);        

}

To print a pointer in C you should use %p instead of %d, see

http://stackoverflow.com/questions/5286451/how-to-print-variable-addresses-in-c

Also, a is already a pointer. So, instead of

printf("address of a=%d\n",*a);

I think you should use

printf("address of a=%p\n",a);