This wiki is out of date, use the continuation of this wiki instead

Sort

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 00:11, 12 July 2007 (edit)
Sandman (Talk | contribs)

← Previous diff
Revision as of 00:13, 12 July 2007 (edit) (undo)
Sandman (Talk | contribs)
m
Next diff →
Line 5: Line 5:
'''STRING''' sort ( <'''VARSPACE''' array> , [<'''INT''' datacount>] ) '''STRING''' sort ( <'''VARSPACE''' array> , [<'''INT''' datacount>] )
-Sorts an array.+Sorts an [[array]] by sorting a certain number of elements. By default the whole array is sorted.
== Parameters == == Parameters ==

Revision as of 00:13, 12 July 2007


Contents

Definition

STRING sort ( <VARSPACE array> , [<INT datacount>] )

Sorts an array by sorting a certain number of elements. By default the whole array is sorted.

Parameters

VARSPACE array - The array to be sorted.
[INT datacount] - Number of elements to sort.

Returns

INT: true

Example

Program sorting;
Const
    myarray_length = 10;
Global
    int myarray[myarray_length-1];
Begin

    // Insert random numbers
    for(x=0; x<myarray_length; x++)
        myarray[x] = rand(0,100);
    end

    // Show array
    say("--------------------");
    for(x=0; x<myarray_length; x++)
        say(x + " - " + myarray[x]);
    end

    // Sort
    sort(myarray);

    // Show array
    say("--------------------");
    for(x=0; x<myarray_length; x++)
        say(x + " - " + myarray[x]);
    end

    // Wait until ESC is pressed
    Repeat
         frame;
    Until(key(_esc))

End

Used in example: say(), array, pointer

Personal tools