Data Structure Arrays Question:

Download Job Interview Questions and Answers PDF

Tell me do array subscripts always start with zero?

Arrays Interview Question
Arrays Interview Question

Answer:

Yes. If you have an array a[MAX] (in which MAX is some value known at compile time), the first element is a[0], and the last element is a[MAX-1]. This arrangement is different from what you would find in some other languages. In some languages, such as some versions of BASIC, the elements would be a[1] through a[MAX], and in other languages, such as Pascal, you can have it either way.

Download Arrays Interview Questions And Answers PDF

Previous QuestionNext Question
What will be output if you will execute following c code?
#include<stdio.h>
void main(){
long double a;
signed char b;
int arr[sizeof(!a+b)];
printf("%d",sizeof(arr))
}
Explain is it valid to address one element beyond the end of an array?