Connecting Tech Pros Worldwide Forums | Help | Site Map

c pointers (ptrdiff_t)

andy_dufresne
Guest
 
Posts: n/a
#1: Nov 30 '05
have posted the question here:

http://groups.google.com/group/progr...b58c897f890930


Mark McIntyre
Guest
 
Posts: n/a
#2: Nov 30 '05

re: c pointers (ptrdiff_t)


On 30 Nov 2005 11:24:06 -0800, in comp.lang.c , "andy_dufresne"
<akshayrao@gmail.com> wrote:
[color=blue]
>have posted the question here:
>
>http://groups.google.com/group/progr...b58c897f890930[/color]

Then please post it here, too, assuming its topical.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Brytison
Guest
 
Posts: n/a
#3: Dec 1 '05

re: c pointers (ptrdiff_t)


can't replace to other site, just here only, post you question at here
better.

"andy_dufresne" <akshayrao@gmail.com>
??????:1133378646.137338.75170@g47g2000cwa.googleg roups.com...[color=blue]
> have posted the question here:
>
>[/color]
http://groups.google.com/group/progr...d/75b58c897f89
0930[color=blue]
>[/color]


andy_dufresne
Guest
 
Posts: n/a
#4: Dec 1 '05

re: c pointers (ptrdiff_t)


sorry abt that.
here's the question:

hi,
i'd a question abt taking the difference between two pointers.
for eg: if you have 2 char pointers pointing to members of an array,
you
advance one till you encounter a space then take the difference between
the two, will give the correct length of the string irrespective of
whether char is represented by 2 bytes (like in unicode)?? i believe it
would give the correct length, because the compiler is responsible for
scaling the difference when one advances a pointer to point to the next
element like ptr++, or is it that pointer difference (subtraction
between two
pointers to members of the same array) is not pointer arithmetic and we
need
to scale it??

eg problem:
Orig string - char *s;
Ptrs, char *start = s, *end = s;
int length;
while(!isspace(*end))
end++;
length = end - start;

is this mentioned somewhere in the c std?? if so could someone pt me in
the right direction.

Thanks.

Closed Thread