hi guys, anyone see what is wrong with this, i can implement this without structs but using structs i can not do it.
thanks!
Code:void swap( student_t *fval, student_t *sval ) { student_t temp; temp = *fval; *fval = *sval; *sval = temp; }
hi guys, anyone see what is wrong with this, i can implement this without structs but using structs i can not do it.
thanks!
Code:void swap( student_t *fval, student_t *sval ) { student_t temp; temp = *fval; *fval = *sval; *sval = temp; }
Last edited by kurz7; 05-18-2003 at 02:47 AM.
there are only 10 people in the world, those who know binary and those who dont
What are you trying to swap? Your swapping as listed here only swaps the value. As such, the ID doesn't get changed, the ID just gets a different value assigned to it. Is this really what you want? Or are you trying to swap the whole structure / contents?
Quzah.
Hope is the first step on the road to disappointment.
sorry i didnt make the problem clear, all i wanted to do was sort the structure from lowest mark to highest mark with student id respectively
there are only 10 people in the world, those who know binary and those who dont
hi ive fixed up my code but i cant seem to swap the elements in the array. anyone can help?
in my swap function how do i make it so i can swap the structure in the array? for example if element 1 is bigger then element 2 in the array, i want to swap the elements around. so element 2 jumps into slot 1 and element 1 goes in slot 2...
THANKS!
there are only 10 people in the world, those who know binary and those who dont
ops i didnt see that
THANKS! Salem
there are only 10 people in the world, those who know binary and those who dont