Article View: net.lang.c
Article #9082C Coding Question
From: Tad Marko
Date: Sat, 09 Aug 1986 21:39
Date: Sat, 09 Aug 1986 21:39
45 lines
1548 bytes
1548 bytes
[line eater fodder]
Hey, everybody, I discovered a "new" (new to me) way of coding such static
things as descriptions, helps, and the like. It goes like this:
#include <stdio.h>
char *help[] = {
"You do it this way, dummy:",
"",
"so on and so forth...",
NULL
};
char *description[] = {
"I do this...",
"no much of anything...",
NULL
};
main()
{
say(help);
printf("\n");
say(description);
}
say(dp)
char *dp[];
{
while (*dp != NULL)
printf("%s\n", *dp++);
}
Here's the question: Should help and description be declared char *help[]
or char **help? Should say() be declared void, or is there some sort of
error checking I should implement? Are there any other suggestions or
comments? How about any other neat "tricks" anyone has discovered lately?
Tad
--
Tad Marko
..!ihnp4!killer!tad || ..!ihnp4!alamo!infoswx!ntvax!tad
UNIX Connection BBS AT&T 3B2 North Texas State U. VAX 11/780
If it's not nailed down, it's mine; If I can pick it up, it's not nailed down.
Technical Details
Message-ID:
<248@killer.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!cbosgd!ihnp4!cuae2!ltuxa!we53!sw013b!dj3b1!killer!tadShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!cbosgd!ihnp4!cuae2!ltuxa!we53!sw013b!dj3b1!killer!tad From: tad@killer.UUCP (Tad Marko) Newsgroups: net.lang.c Subject: C Coding Question Message-ID: <248@killer.UUCP> Date: Sat, 9-Aug-86 17:39:27 EDT Article-I.D.: killer.248 Posted: Sat Aug 9 17:39:27 1986 Date-Received: Mon, 11-Aug-86 02:26:03 EDT Organization: The Unix(tm) Connection BBS, Dallas, Tx Lines: 45 Keywords: Attention all nit-pickers...