Optional parameters: Difference between revisions

m
→‎{{header|C}}: minor improvements
(Added C)
m (→‎{{header|C}}: minor improvements)
Line 89:
} *Table;
 
typedef int (*CompareFctn)( const Stringchar *a, const Stringchar *b);
 
struct {
Line 99:
int CmprRows( const void *aa, const void *bb)
{
String **rA = *(String **)aa;
String **rB = *(String **)bb;
int sortCol = sortSpec.column;
 
String left = sortSpec.reversed ? (*rB)[sortCol] : (*rA)[sortCol];
String right = sortSpec.reversed ? (*rA)[sortCol] : (*rB)[sortCol];
return sortSpec.compare( left, right );
}
Line 219:
String r5[] = { "ab1a", "blak", "Factor" };
String r6[] = { "ab1b", "brwn", "C Sharp" };
String r7[] = { "Ab1aAb1b", "pink", "Ruby" };
String r8[] = { "ab1", "orng", "Scheme" };
 
Line 245:
return 0;
}</lang>
 
=={{header|C++}}==
This implementation only accepts function pointers for the comparators, and does not accept function objects, for simplicity.
Anonymous user