Re: Neatest way to get the end pointer?
  Home FAQ Contact Sign in
comp.lang.c only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.c Profile…
 Up
Re: Neatest way to get the end pointer?         


Author: pete
Date: Feb 6, 2008 04:37

Keith Thompson wrote:
>
> Peter Nilsson acay.com.au> writes:
>> vipps...@gmail.com wrote:
>>> Peter Nilsson acay.com.au> wrote:
>>>> ...
>>>> Â int *p = my_array;
>>>> Â int const *const pend = my_array + sizeof my_array/
>>>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â sizeof*my_array;
>>>> Â do *p++ = 42;
>>>> Â while (pend != p);
>>>
>>>> At no stage is pend dereferenced; and the loop exits on
>>>> p == pend, so the address is not dereferenced by p
>>>> either.
>>>
>>> Ah, I was a bit confused I guess.
>>> However, OP _does_ dereference it. Not in that snipped,
>>> but in 4)
>>> ...
Show full article (2.02Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
Pointer to Pointeruw.cs.cs136 ·
Re: Pointers problem - Unable to dereference NULL pointercomp.lang.idlpvwave ·