--- 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
Absolutely true, Abhiraj. Source is K&R "The C Programming Language". Internally, C converts arrays to pointer addresses and offsets, immediately anyway. a[2] becomes *(a + 2), with a being the name of the array, and the name of the array is always the address of the array's first element. Usually, pointers are faster because they do not have to be converted to pointer and offset, and the value in the array element may be a double, etc. In a few tests I ran years ago, the pointers were not as fast if the array was an array of integers, however. Just a tad slower, but slower. With the larger memories today, and 32 (or 64 bit coming out now), compilers, that may have changed. Dave ------------------------ 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/
