Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Searching for a particular address in a given range (http://www.go4expert.com/forums/searching-particular-address-range-t23934/)

xyz1987 20Nov2010 14:30

Searching for a particular address in a given range
 
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 21Nov2010 12:16

Re: Searching for a particular address in a given range
 
Hi,

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 21Nov2010 14:37

Re: Searching for a particular address in a given range
 
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.


All times are GMT +5.5. The time now is 16:55.