GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Concepts  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 23 of 68    Print  
Why C or C++ Stack index starts from 0.

  
Total Answers and Comments: 3 Last Update: November 05, 2008     Asked by: hrusi_dalai 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 08, 2006 16:58:16   #1  
RAJEEV CHOPRA        

RE: Why C or C++ Stack index starts from 0.
Any basic units of memory representation bit bite starts from 0.


A byte contains 8 bits starting from 0 to 7.


This is the idea of stack and array in C C++ starts from 0.

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
April 08, 2007 02:36:18   #2  
dhanasweet Member Since: March 2007   Contribution: 29    

RE: Why C or C++ Stack index starts from 0.
if we declare an array a[5] the memory allocate to each member will be accessed by a[0] a[1] .....a[4]. this is the reason index starts with zero.
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
November 05, 2008 16:56:44   #3  
johnferguson Member Since: November 2008   Contribution: 1    

RE: Why C or C++ Stack index starts from 0.

Pointer arithmetic. Add 0 to the pointer and you get the pointer.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape