06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

qsort pREPC+ <strong>System</strong> <strong>Calls</strong><br />

qsort Sorts an array.<br />

#include <br />

void qsort(<br />

void *base, /* array base */<br />

size_t nmemb, /* array length */<br />

size_t size, /* array element size */<br />

int (*compar) (const void *, const void *)<br />

/* comparison function */<br />

)<br />

Description<br />

Arguments<br />

Return Value<br />

The qsort() function sorts an array of nmemb objects, the initial element of which<br />

is pointed to by base. The size of each object is specified by size.<br />

The array is sorted in ascending order according to the user-supplied function<br />

pointed to by compar. The compar function is called with two arguments that point<br />

to the objects being compared. The compar function must return an integer that is<br />

less than, equal to, or greater than 0 if the first argument is considered less than,<br />

equal to, or greater than the second argument, respectively. The compar function<br />

can call all pREPC+ character handling functions and all pREPC+ string handling<br />

functions except strtok(). Other pREPC+ functions cannot be called from<br />

compar.<br />

If two members of the array are equal, their order in the sorted array is unspecified.<br />

base Points to the beginning of the array.<br />

nmemb Specifies the length of the array.<br />

size Specifies the size of each member of the array.<br />

compar Points to the user-supplied comparison function.<br />

This function does not return a value.<br />

3-120 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!