Searching for a particular address in a given range

xyz1987's Avatar, Join Date: Nov 2010
Newbie Member
Can anyone help me with searching for a particular address in a given range in C. like i have to search for *ptr in range specified by *high and *low. i think it is not same as linear search. can someone provide some input. thanks.
crazyNut's Avatar, Join Date: Nov 2010
Light Poster

I am also a newbie so correct me if i am wrong.

What I understand from your problem that you want to find an address *ptr in C ranging form *high to *low

say you have three variables
*ptr = 5
*low = 1
*high = 10

then you want to find the address of 5 i.e the offset of 5 in the list if the list elements are
1, 3, 5, 7, 9, 10.

Is it what you are asking?
xpi0t0s's Avatar, Join Date: Aug 2004
This doesn't make sense. * dereferences the pointers, so if ptr, high and low contain addresses, then *ptr, *high and *low represent the values in memory at those addresses. It also doesn't make any sense that you want to look for ptr when you already have it. So please restate the question.