CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
Is it better to use a pointer to navigate an array of values,or is it better to use a subscripted array name?



Category C Interview Questions
Rating (0.0) By 0 users
Added on 7/19/2006
Views 1447
Rate it!
Answers:

It?s easier for a C compiler to generate good code for pointers than for subscripts.



yes it is easier to navigate an array through pointer because if we are using pointers then we can make faster access to array elements as compared to accessing array elements through subscripted array names.



 Posted by: SAJAG RACHHORA    

Contact SAJAG RACHHORA  Contact SAJAG RACHHORA

yes it is better to use a pointer to navigate an array of values because then we can access any element of array directly without accessing the values present before it.



 Posted by: JAYA GOYAL    

Contact JAYA GOYAL  Contact JAYA GOYAL

it is better to use array subscript because if you are using a pointer variable you need two memory accesses one for getting the pointer data and the other is for actual data but if you are using array subscript we need only one memory acess



 Posted by: rekha    

Contact rekha  Contact rekha

whether you access with pointer or with subscript ,both retrieve value within same time.because implicitly
subscripts are internally implented as
pointers.
for eg: a[i] equivalent to *(a+i)



 Posted by: srinivas    

Contact srinivas  Contact srinivas

Yes, It is easy & efficient to use pointer to acces array elements because subscript finaly conveted to pointer notation by compiler. for ex. a[i] will converted by compiler as *(a+i).



 Posted by: Harishankar Singh    

Contact Harishankar Singh  Contact Harishankar Singh


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
Can the sizeof operator be used to tell the size of an array passed to a function?


View Answer
Is using exit() the same as using return?


View Answer
Is it possible to execute code even after the program exits the main() function?


View Answer
What is a static function?


View Answer
How do you print an address?


View Answer
What is the difference between NULL and NUL?


View Answer
What is the stack?


View Answer
What is a null pointer?


View Answer
How can I convert a number to a string?


View Answer
What is the difference between #include <file> and #include ?file??


View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/6072/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.7