I currently have a program that I am writing where I am implementing a Mergesort array. The array has unknown variables - it is a pointer to the void, so I actually do not know which objects I sort (there is a comparison function that passed for actual comparisons).
How can I traverse an array when it is a pointer to void? I found out that I cannot just use a typical array format (i.e. arr[3]), as it is a pointer to void. There is a parameter passed to my functions that contains the size of the mystery elements, so I suppose I need it. Is there a way that I could use it depending on the size provided, so I CAN use this typical array format, or do I need to use pointer arithmetic (again, to somehow apply it to a specific size)?
Thanks to everyone who makes any contribution! :)
user2883993
source
share