This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Finding the Maximum INT value in a given Array or 6 Variables

Hello everybody, I have a problem and need help. I have declared 6 Unsigned integer variables in my code they store different values and I want to find out which variable contains the maximum value. There can also be an array of 6 integer elements.

Quickest response will be appreciated.

Parents
  • well, I would look for sorting routines, that is really what you need. Since you say that the problem is size, a "let the high float up" is probably the least code size hungry.

    pseudo code
    loop:
    if array[index] > array[index+1}
    interchange entries and loop
    if index = max-1 done
    else index = 0 loop

    anyhow, just look for "sort" the litterature is immense

    Erik

Reply
  • well, I would look for sorting routines, that is really what you need. Since you say that the problem is size, a "let the high float up" is probably the least code size hungry.

    pseudo code
    loop:
    if array[index] > array[index+1}
    interchange entries and loop
    if index = max-1 done
    else index = 0 loop

    anyhow, just look for "sort" the litterature is immense

    Erik

Children
No data