Above main(), but after the definition of course, add a declaration
Code:
void search_course(course arr[], int length);
Anywhere (except before the declaration of search_course(), and not inside another function body or type definition) define that function.
Code:
void search_course(course arr[], int length)
{
/* Move whatever code needed into here to implement the search_course() behaviour */
}
Note that I'm assuming you want this function in the same source file as main(). This definition can even be below the main() function.
Lastly you need to include a statement in main() to call the function. For example;
Code:
int main()
{
course a[8] = {
{"ANTH", 395, 3, "Work, Technology, and Society An IT Perspective"},
{"CDS", 130, 3, "Computing for Scientists"},
{"CHEM", 350, 3, "Computer Techniques for Chemistry"},
{"CEIE", 117, 3, "Information Technology for Engineering"},
{"GOVT", 300, 4, "Research Methods and Analysis"},
{"HIST", 390, 3, "The Digital Past"},
{"IT", 103, 3, "Introduction to Computing"},
{"MUSI", 415, 3, "Music in Computer Technology"}
};
search_course(a, 8);
}
If you have other arrays you want to call search_course() for, then there is nothing preventing you adding additional lines to main(), like
Code:
search_course(b, 9); /* Assuming we have another array of course named b, with 9 elements */
The declaration of search_course() above main() helps the compiler know what search_course() is ..... the compiler will not look ahead (if the implementation of search_course() is later in the file, or in another file) so will not know what search_course() is without that declaration.