Questions tagged [fixed-length-array]

4 questions
246
votes
8 answers

How to declare a Fixed length Array in TypeScript

At the risk of demonstrating my lack of knowledge surrounding TypeScript types - I have the following question. When you make a type declaration for an array like this... position: Array; ...it will let you make an array with arbitrary…
henryJack
  • 4,220
  • 2
  • 20
  • 24
1
vote
2 answers

Binary array needs to have a fixed length

I'm currently working on a binary-encoder which, when finished, should check certain checkboxes based on the decimal number that's entered. I already have the script for converting the number to an array. An output for the number 512 would be [1, 0,…
0
votes
2 answers

Can you dynamically allocate a partially fixed-size array in C (2d array)?

I wanted to dynamically allocate a partially fixed size array, but ran into errors which would lead me to believe I don't actually know how an array like this functions, so I'm trying to figure out how would you dynamically allocate in this…
-1
votes
2 answers

If Scala is a compiled language, then why didn't it detect an out of bound exception in this program beforehand?

The program is: object Hello extends App { val a: List[Int] = List(1, 3, 4, 5, 8, 10, 11, 22, 33) for (i <- 0 to 11) println(a(i)) } The Output is: 1 3 4 5 8 10 11 22 33 java.lang.IndexOutOfBoundsException: 9 // continues as a…