English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories
0

What does the following program fragment do? Does it do it correctly? If not debug and adjust any errors.



int[] numbers = new numbers[10];

int index;

For (index = 0; index < 10; ++index)

numbers[index] = index;

2007-04-22 16:15:35 · 1 answers · asked by TheOne 1 in Computers & Internet Programming & Design

1 answers

'Allocate an array called numbers that allocates integers
'identified as 0 through 10 (That's space for eleven integers).
int[] numbers = new numbers[10];
' Declare an integer called index
int index;
'Loop through the For loop 10 times with the index
'set to 0 through 9.
For (index = 0; index < 10; ++index)
'set the array position index to the value: 0, 1,...,9
' so that numbers[0]=0, numers[1]=1, and so on.
numbers[index] = index;
Next i

2007-04-22 16:24:01 · answer #1 · answered by Skeptic 7 · 0 0

fedest.com, questions and answers