rotovegasBoy
Programmer
I'm a second year student at university in New Zealand. That will be a sophmore in college to most of you (i think).<br>
Any way I'm having real big problems with malloc. My assignment is to compare the effiency of various sorting algorithms. Most of this involves splitting arrays. This in turn mainly involves using dynamically allocated arrays. This is the problem. When I run the algorithms on a small array the program runs fine but when the size gets up there I get seg-faults. Has any one got tips on using malloc and freeing up memory in recursive functions. Before any one suggests c++ the program has to be in C. The actual algorithms themselves aren't much of the problem they've been supplied in pseudo code by Prof. Tadoka, the problem is translating the specifically into C.
Any way I'm having real big problems with malloc. My assignment is to compare the effiency of various sorting algorithms. Most of this involves splitting arrays. This in turn mainly involves using dynamically allocated arrays. This is the problem. When I run the algorithms on a small array the program runs fine but when the size gets up there I get seg-faults. Has any one got tips on using malloc and freeing up memory in recursive functions. Before any one suggests c++ the program has to be in C. The actual algorithms themselves aren't much of the problem they've been supplied in pseudo code by Prof. Tadoka, the problem is translating the specifically into C.