TutPtrArySwapItems exchange the two specified elements in a pointer array
ptr_ary
pointer array to operate on
index1
index of the first element
index2
index of the second element
TRUE
if the operation is a success, FALSE
otherwise.
None
TutPtrArySwapItems exchanges the two items at the specified indices. The function returns TRUE
if the operation was successful and FALSE
if invalid indices were specified.
TutPtrArySwapItems calls the pointer array change callbacks with the reason T_PA_ITEMS_SWAPPED.
None
TutPtrAryCreate, TutPtrArySort
This example swaps items in a pointer array:
T_PTR_ARY ptr_ary; T_INT4 i, *int_ptr;/* create the pointer array with initial size of 30 */
ptr_ary = TutPtrAryCreate(30);/* fill it up with 25 entries */
for (i = 0; i < 25; i++) {/* allocate the space for the next element */
T_MALLOC(int_ptr, sizeof(T_INT4), T_INT4 *); *int_ptr = i;/* append the item to the array, ignore the index */
TutPtrAryAppend(ptr_ary, int_ptr, NULL); }/* swap items at indices 4 and 12 */
TutPtrArySwapItems(ptr_ary, 4, 12);
TIBCO SmartSockets™ Utilities Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |