Skip to content

Instantly share code, notes, and snippets.

@itsaboutcode
Created November 30, 2010 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsaboutcode/721888 to your computer and use it in GitHub Desktop.
Save itsaboutcode/721888 to your computer and use it in GitHub Desktop.
Find Min between subarray
int get_min_range(int array[], int firstSubscript, int lastSubscript)
{
int smallestValue = array[firstSubscript];
int smalledIndex = firstSubscript;
for (int i = firstSubscript; i <= lastSubscript; i++)
{
if (array[firstSubscript] < smallestValue)
{
smallestValue = array[firstSubscript];
smalledIndex = firstSubscript;
}
}
return smalledIndex;
}
@itsaboutcode
Copy link
Author

Program Description

Write function "getminrange" which returns the subscript of the smallest value in a portion of an array containing type int values. It has three arguments: an array, the first subscript in the subarray, and the last subscript in the subarray.

http://www.cramster.com/answers-nov-10/computer-science/arrays-write-function-quotget-min-rangequot-returns_1027784.aspx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment