[prev] [index] [next]

Exercise: Array Initialisation

Write a program to determine answers to the following:
  • what happens if we declare v[8] but only give 6 values?
  • what happens if we declare v[8] but give 10 values?
  • is there an equivalent but simpler way to define s?
  • how can we determine the number of elements in w[]?
Hint for last one: sizeof() operator (returns a value of type unsigned or unsigned long)