Weird error being returned by codeblocks

This is a part of the code for a assignment. it compiles properly but whenver i run it it runs fine up until where i call the index_sort function where codeblocks returns the value 255<OxFF> as error and terminates .

I wanted to mention something unrelated to the problem first:
You should really consider code indentation: http://en.wikipedia.org/wiki/Indent_style
It makes your code a lot more readable and you won't need any lines like "end of for loop".
Also, give every statement its own line, rather than writing multiple on a single line.

As for your problem - I assume you want the csv file to be loaded into the array?
However, I don't see any statement of you loading any information of your stud-array, which you are wanting to sort. As the index_sort function assumes there is content in the array, a memory error will occur when you try to access its non-existant members.

> However, I don't see any statement of you loading any information of your stud-array,
> which you are wanting to sort.
> As the index_sort function assumes there is content in the array,
> a memory error will occur when you try to access its non-existant members.
The members do exist, they have garbage.
However, sorting garbage shouldn't produce a crash.

The elements of `a' are unintialized, and you are using them to index another array. That may access out of bounds

Thanks just figured out i forgot to initialize the index array a[]. Progs working perfectly now
I had skipped the code to load in data into to student array so as to keep to code short.
Will indent properly next time.