suppose I have:

#define special_for(X,Y) { register int i = 0; for (;i<X;i++) {Y} }

It is used in the following functions:

init_lineholder(int nlines)
{
special_for(nlines, lineptr[i] = (char *)malloc(MAXLEN); tmp++;)
}

AND

print_lines()
{
special_for(tmp, if (lineptr[(first+tmp-i)%tmp] == NULL) break; else
printf("%s\n", lineptr[(first+tmp-i)%tmp]) ; ) /* had to space bcuz of stupid smiley */
}


how do I rewrite the functions so I don't need to use the special_for macro?

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.