Lines Matching refs:array
7 applied as an argument, along with the size of the objects in the array
26 In order to use the sorted array library functions, you have to describe
27 how to compare the elements of the array.
30 the array. The library will call this function, passing as arguments
31 pointers to two array elements to be compared. Your comparison function
37 Here is an example of a comparison function which works with an array of
65 @cindex array search function
67 Generally searching for a specific element in an array means that
75 The @code{lfind} function searches in the array with @code{*@var{nmemb}}
80 The return value is a pointer to the matching element in the array
86 the array in which case it might not be useful to sort the array before
94 @c insertion itself would leave the array in a corrupt state (e.g. one
100 @c In case of cancellation, we know the array won't be left in a corrupt
108 searches the given array for an element and returns it if found. The
111 @var{size} bytes) at the end of the array and it increments the value of
114 This means for the caller that if it is not sure that the array contains
115 the element one is searching for the memory allocated for the array
117 bytes. If one is sure the element is in the array it is better to use
118 @code{lfind} so having more room in the array is always necessary when
122 To search a sorted array for an element matching the key, use the
127 @deftypefun {void *} bsearch (const void *@var{key}, const void *@var{array}, size_t @var{count}, s…
130 The @code{bsearch} function searches the sorted array @var{array} for an object
131 that is equivalent to @var{key}. The array contains @var{count} elements,
138 than its second argument. The elements of the @var{array} must already
141 The return value is a pointer to the matching array element, or a null
142 pointer if no match is found. If the array contains more than one element
153 @cindex array sort function
155 To sort an array using an arbitrary comparison function, use the
160 @deftypefun void qsort (void *@var{array}, size_t @var{count}, size_t @var{size}, comparison_fn_t @…
163 The @code{qsort} function sorts the array @var{array}. The array
167 array elements. This function is called with two pointer arguments and
180 within the array, they need not correspond with the original locations
182 in the array before making some comparisons. The only way to perform
186 Here is a simple example of sorting an array of doubles in numerical
192 double *array;
195 qsort (array, size, sizeof (double), compare_doubles);
204 the array.
211 with an array of structures. The objects in the array are sorted
266 or unsorted array. There are other methods to organize information
386 @c Unlike the lsearch array, the htab is (at least in part) opaque, so