Quote Originally Posted by Sephiroth1109 View Post
There is no other error then this build error. I just figured since the build error drops it in that make file that there was something there. And I really have told you all that I know, and I've been working on this thing for the duration that it's been assigned. And yeah I just realized I forgot to change my pseudo code back. L and R were used as the Left and Right child. Which later I tried to access as bytes of memory, atleast I think that's what I'm supposed to do. What I'm having trouble with exactly, I need to access the data, maybe cast it to something and have a way to compare it.
You are not supposed to do any such thing. You are not supposed to know anything about this data except (1) its address and (2) the address of a function that compares two pieces of data. Did you see that int (*)(const void *, const void *) in your function declaration? Did you ever wonder what it was? It's a function that will be passed in to your function that knows how to compare ... whatever it is that we have. If your using strings for now, you could pass in strcmp, which does exactly what your code expects of it. You should make the change that I mentioned earlier, and give it a name, like "cmp". (If you want information, you can look up "function pointers in C". In fact, given the name of the class, I would be willing to bet as much as a quarter that the whole point of this assignment was to teach you how to use function pointers.)

But I don't know how to do that and keep it generic. If I could maybe store it in an array, but I'm not sure how to do that with data that can be anything. Anywho, there is only 1 error that appears in the list but it doesn't give much information.

C:\Dev-Cpp\Makefile.win [Build Error] [srtshak.o] Error 1
This tells me that the person who wrote shake sort didn't get theirs done either. You can't compile what you don't have? Anyway, your errors in your file will not be in "Compile Log", but in "Compiler" under Dev-C++. Hit Ctrl-F11 to clear out previous things and re-compile from scratch.

Okay let me try to give in depth what I'm trying to do. I'm trying to do a heapsort which compares the last element first. Checks the children and swaps accordingly. Now what i tried to do is say that base is where the first element is. The last element is the base + (The byte size of the element * the number of elements that there are. I tried to access the data pieces like that, but quite frankly I can't even get my professors sorting algorithms to compile. I tried some different envirnments and actually I feel quite lost. I'm working on this with another classmate right now and what he's trying to do is cast the void pointer into a char. But it doesn't seem to be working for him either. I tried to do several checks inside the loops if it has a child, has a right child if it has a left child, then I tried to swap the datapieces. If this was a constant piece of data, I wouldn't even be asking anything. I tried several times sorting a tree on paper with heapsort, and using these ideas to get to the next data piece, and they all make sense to me. But at this point I don't know whether it's my code that is having a problem or the compiler cannot compile C code. So I'm searching for something, maybe a compiler I can use at the dos prompt. Anywho, thanks again for any suggestions. I'll be continuing to work on this.
Dev-C++ is just gcc, so of course you can use it at a dos prompt if you need to. To get at just your code, you can try "gcc -Wall -c srtheap.c -o srtheap.o" (you may need to put gcc's directory in your path, or type it explicitly; mine is "C:\Dev-Cpp\bin\gcc").

My suggestion, and I'm being serious, is to use real variable names and revise your code. Things look pretty similar to what a heapsort should be, but p1 and p2 don't always seem to mean the same thing and maybe you've got redundant checks, or maybe they're not the same check but you're reusing the names, or something. As to compiling, if you don't have all 5 .c files in hand ready to go, the build will never work. Maybe remove all but yours (and main--was that instructor written or you written?) so that you don't have to worry about the other three.