# how to copy a pointer to a 2-D array

int dz[4][2]={{0,4},{4,8},(8,4),(4,0)};

int* short_dist(int, int);

int* short_dist(int x,int y)
{
int sd,temp=100;
int ptr;
int i;
for (i=0;i<4;i++)
{
sd=sqrt(pow((x-dz_[0]),2)+pow((y-dz
[1]),2));_
_
if (sd<s)_
_
{_
_
temp=sd;_
_ ptr=(dz+(2i));_

* }*
* }*

*} *
[/quote]
i have declared the dz array as global (outside the func). The error given is
> In function 'int* short_dist(int, int)':
> error: cannot convert 'int ()[2]' to 'int' in assignment
plz help!!!

In function 'int* short_dist(int, int)':
error: cannot convert 'int ()[2]' to 'int' in assignment

This would probably be for the line `      ptr=(dz+(2*i));`
I'm not sure what you want there, perhaps`ptr = &dz[i][1];`

``````int dz[4][2]={{0,4},{4,8},(8,4),(4,0)};
``````

must be:

``````int dz[4][2]={{0,4},{4,8},{8,4},{4,0}};
``````

maybe it could be:

``````byte dz[4][2]={{0,4},{4,8},{8,4},{4,0}}; //saves 50% RAM
``````

hmm its ok i figured it out..

its

`````` ptr=*(dz+k)
``````

yes i will implement the byte suggestion, thank you:)