Optional parameters: Difference between revisions

(omit factor)
Line 83:
#include <string.h>
 
typedef const char * String;
typedef struct sTable {
String * *rows;
Line 118:
* true(nonzero) or false(zero) and if true, the sort will b in reverse order
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int sortTable(Table tbl, const char* argSpec,... )
{
va_list vl;
const char *p;
int c;
sortSpec.compare = &strcmp;
Line 149:
}
 
void printTable( Table tbl, FILE *fout, const char *colFmts[])
{
int row, col;
Line 165:
int ord(char v)
{
static const char *digits="0123456789";
return strchr(digits, v)-digits;
}
Line 172:
int cmprStrgs(const String s1,const String s2)
{
const char *p1 = s1;
const char *p2 = s2;
const char *mrk1, *mrk2;
while ((tolower(*p1) == tolower(*p2)) && *p1) {
p1++; p2++;
Line 212:
int main(int argc, char **argv)
{
const char *colFmts[] = {" %-5.5s"," %-5.5s"," %-9.9s"};
String r1[] = { "a101", "red", "Java" };
String r2[] = { "ab40", "gren", "Smalltalk" };
Anonymous user