answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Does this correctly create an array of 5 elementsint 5 myArray new int?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Find index number of an given array?

For instance, you have array of type int with a name myArray, and you do not know size of the array. You can use following statement to get it:int arraySize = myArray/myArray[0];arraySize gives you number of elements in myArray.


Write a program to find the largest of n numbers in java?

Assuming the numbers are integers, and they are stored in an array called myArray. The following has not been tested, but gives the general idea: int max; max = myArray[0]; for (int i = 1; i < myArray.length(); i++) } if (myArray[i] > max) max = myArray[i]; System.out.println(max); }Assuming the numbers are integers, and they are stored in an array called myArray. The following has not been tested, but gives the general idea: int max; max = myArray[0]; for (int i = 1; i < myArray.length(); i++) } if (myArray[i] > max) max = myArray[i]; System.out.println(max); }Assuming the numbers are integers, and they are stored in an array called myArray. The following has not been tested, but gives the general idea: int max; max = myArray[0]; for (int i = 1; i < myArray.length(); i++) } if (myArray[i] > max) max = myArray[i]; System.out.println(max); }Assuming the numbers are integers, and they are stored in an array called myArray. The following has not been tested, but gives the general idea: int max; max = myArray[0]; for (int i = 1; i < myArray.length(); i++) } if (myArray[i] > max) max = myArray[i]; System.out.println(max); }


Can you write a source code to find the sum and the largest number of a given array?

In Java, assuming you already created an array of int's, called myArray:int max = myArray[0];int sum = 0;for (int i = 0; i < myArray.length; i++){sum += myArray[i];if (myArray[i] > max)sum = myArray[i]}


Meaing of Associative Array in PHP?

There are two types of arrays, associative arrays, and indexed arrays. Indexed arrays are where you access the items in order, for example $myArray[0] would be the first item in the array, $myArray[1] would be the second item, and so on. You can create an indexed array like this: $myArray = array("item1","item2","item3"); echo $myArray[0]; //item1 echo $myArray[2]; //item3 You can also set your own indexes: $myArray = array(0=&gt;"item1", 1=&gt;"item2", 5=&gt;"number 5"); echo $myArray[0]; //item1 echo $myArray[2]; //null or doesnt exist, i cant remember You can also add items after using the square-brackets. If you include a number, that index is set, otherwise it just adds it to the end of the array. $myArray[9] = "set index 9"; $myArray[] = "add to the end of the array"; Associative arrays use strings instead of numbers. $colors = array("cat"=&gt;"brown", "dog"=&gt;"yellow", "fish"=&gt;"purple"); echo $colors["cat"]; //brown echo $colors["fish"]; //purple And you can add more with the square-brackets again. $colors["camel"] = "green"; To loop through both types of arrays you can use a foreach loop, or to loop through indexed arrays you can get the length into a variable and a do normal for loop.


How do you relate pointer and array?

name of array point to the first element of array. actually when we use int myarray[10]; compiler make space for 10 integer in sequence (if 2 byte for each int then 20 byte for 10). and name of the array in this case myarray point to the first element of that sequence. When we say myarray[n] (0 &lt;= n &lt; 10 in this case), then this is treated as, content of address, myarray + (n*byte_per_integer).


How do you make an array of 56?

In Java:int[] myArray;// or: int myArray[]followed by:myArray = new int[16];Instead of int, you can use any other data type, including a class.


What number has the most arrays?

You have array of type int with a name myArray, and you do not know size of the array.


How do you get the array values in C plus plus?

Use the array suffix operator ([]), or use a pointer offset from the start of the array, such that an offset of 1 is equivalent to the size of an array element (all elements in an array must be of equal size). The latter method is what actually goes on behind the scenes when using the array suffix operator, but the former is generally easier to use.


How are array of structure variables defined?

struct Foobar myarray [32]; or struct { int foo; double bar; } myarray [32];


What is array What is difference between array and simple variable?

An array stores several values - for example, several numbers - using a single variable name. The programmer can access the individual values with a subscript, for example, myArray[0], myArray[5]. The subscript can also be a variable, for example, myArray[i], making it easy to write a loop that processes all the elements of an array, or some of them, one after another.


Can you write a character into a specific array index in c?

Yes, you can but the array must be char-type. ... int arraySize = 3;char myArray[arraySize]; ... for (intarrayIndex = 0; arrayIndex < arraySize; arrayInsex++) { cin >> myArray[arrayIndex]; //It will write three character (keys which you pressed) in myArray} ...


How you can initialize an array with data values during declaration?

int myArray[] = {1,2,3,4,5};