Hi,
can we write a function in c, tht can accept any type of array, may tht be int, float, char, struct or of any any kind, as an argument and perform some task of tht like sorting etc.
Thank you
abrarsyed
0
Newbie Poster
Recommended Answers
Jump to PostOf course you can. Declare the array parameter as a pointer to void, add a parameter that tells the function what the type is, use the type parameter in a switch statement or if-then-elses, and cast the array parameter appropriately in each case.
The afforementioned qsort function is only slight …
All 3 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
Sokurenko
42
Junior Poster
KenJackson
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.