Anonymous user
Assigning Values to an Array: Difference between revisions
→{{header|C sharp|C #}}
(added standard ml) |
|||
Line 85:
=={{header|C sharp|C #}}==
'''Language Version:''' 1.0+
<lang csharp>
public void WriteToIntArray(int[] array, int loc, int val)
{
//if the index (zero based) we want to use is greater/equal to our length (one based) throw an exception
if (loc >= array.Length) throw new Exception("Location is out of range.");
//write value to array
array[loc] = val;
}
</lang>
=={{header|C++}}==
|