I have an 800 by 600 image. I want to treat it like a matrix and get the adjacent elements
ex.
(0,0) (1,0) (2,0) (3,0)
(0,1) (1,1) (2,1) (3,1)
(0,2) (1,2) (2,2) (3,2)
(0,3) (1,3) (2,3) (3,3)
example solutions: (0,0) is adjacent to: (1,0) (0,1) (1,1)
(1,1) is adjacent to: (0,0) (1,0) (2,0) (2,1) (2,2) (1,2) (0,2) (0,1)
so I have written a struct array that i will store each one of these points into
typdef struct point
{
int x;
int y;
}point[800*600];
so my first idea was to implement a dfs but that did not really work out so I wanted to get an outside opinion to keep myself on the right track. thanks
arr
an object of typepoint
. What would there be inarr[0].x
? And inarr[0].y
? And inarr[800].x
? ... – pmg