why array index always strats wuth zero?

Answers were Sorted based on User's Feedback



why array index always strats wuth zero?..

Answer / sameer

it because arrays index are pointers and you are giving
offsets from the base pointer & base pointer is starting
element address so it has offset zero from base pointer

Is This Answer Correct ?    11 Yes 3 No

why array index always strats wuth zero?..

Answer / surya.raj

Since I found this questions answer on a another website and
I can do copy and paste from there, but in order to make
copyright and royalty of original poster I am not tending to
do that so, here is the link below from where you can get
answer of your question.

http://developeronline.blogspot.com/2008/04/why-array-index-should-start-from-0.html

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }

1 Answers  


Is this code legal? int *ptr; ptr = (int *) 0x400;

1 Answers  


How can you relate the function with the structure? Explain with an appropriate example.

0 Answers  


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


#define SQR(x) x * x main() { printf("%d", 225/SQR(15)); } a. 1 b. 225 c. 15 d. none of the above

3 Answers   HCL,






‎#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }

2 Answers  


main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }

2 Answers  


#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }

1 Answers  


Is the following code legal? typedef struct a { int x; aType *b; }aType

1 Answers  


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

1 Answers  


hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?

6 Answers  


Categories