Hi, Google Template classes in c++ (or) generic classes in c++ you will get lots of example
Regards, S.C.Harish Associate Software Engineer, Cordys R&D <http://www.cordys.com/>, Hyderabad On Mon, Sep 5, 2011 at 5:11 PM, kARTHIK R <k4rth...@gmail.com> wrote: > For sending the type, you dont have to denote it explicitly. Use templates. > > template<typename T> void func (T *a) { > // business logic > > } > > > I dont think you can pass operators directly. > For arithmetic operators, you could use something like this : [refer some > site for exact syntax] > > template<typename T1, typename T2> void functioname ( T1 *argument, T2 > operation) { > > T1 result = operation(argument[1] , argument[2]); > > } > > > > main() { > > int a[]={1,2,3,4,5}; > functioname(a, std::multiplier<int>()); > > > } > > Karthik R, > R&D Engineer, > Tejas Networks. > > > > On Mon, Sep 5, 2011 at 11:52 AM, punnu <punnu.gino...@gmail.com> wrote: > >> I have to pass a general array in a function whose type will also be >> passed and also a function pointer for ">" or "<". >> e.g. >> >> void function(type , type array, "pointer for > or <") >> >> how will you write it in C? >> >> Thanxx in Advance >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.