--- In [email protected], abhiraj gandhi <[EMAIL PROTECTED]> wrote:
>
> hi everyone
> 
> i am having a query that 
> 
> "Anything that can be done by Using array indexing can
> also be done by using POINTERS that too even faster"
> 
> how it can be done faster .. i have read example in
> LET US  C ...but still i need some more comments from
> group people 
> 
> with regards
> ABHIRAJ

Personally, I am not too concerned with differences in speed. If speed is a 
problem, you will probably gain much more from improving the algorithm.

Having said that, there can certainly be a difference between pointers and 
array indexing in C++. For example, if you define a class as some sort of 
container, then you can define the [] operator to provide indexed access to the 
contents, but inside the class itself there is absolutely no requirement that 
these be stored in an array, and the concept of having a pointer to the data, 
and being able to increment the pointer to point to some other data - this 
concept might well not apply here.

A class that defines the [] operator to allow indexed access can check that the 
index is valid, at least while the code is being debugged. Not so with pointers.

I use pointers mostly for stepping through an array of items, each one in turn, 
and indexing for hopping about at random.

Anand Shraddhan

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/EbFolB/TM
--------------------------------------------------------------------~-> 

>-----------------------------------------~-~>
CHECK THE ARCHIVE BEFORE POSTING!!!! Archive is available at 
http://www.eScribe.com/software/C-Paradise/

>------------------------------------------_->


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/C-Paradise/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to