Thanks Andrew. John hit upon what I needed with va_args. I had used it several years back and had forgotten all about it.
The warnings were mostly generated from my putting together a quick test program to attempt different things. Thanks for the input. You really don't like K&R style! I only get a odd chance at programming and fall back on old styles since I do not do it every day. Thanks --- In [email protected], andrew clarke <[EMAIL PROTECTED]> wrote: > > On Mon 2008-12-08 19:38:49 UTC-0000, mikejd42 ([EMAIL PROTECTED]) wrote: > > > This segfaults. > > > > main( argc, argv ) > > int argc; > > char *argv[]; > > { > > > > func( "hello","this","is","a test" ); > > } > > > > func( argv ) > > char *argv[]; > > { > > > > printf( "argv[0] = %s\n", argv[0] ); > > > > } > > You seriously need to stop writing K&R style. It will bite you. > > Also, compile your programs with ALL warnings enabled. > > $gcc -W -Wall -o a a.c > a.c:2: warning: return type defaults to int' > a.c: In function main': > a.c:6: warning: implicit declaration of function func' > a.c: At top level: > a.c:2: warning: unused parameter 'argc' > a.c:3: warning: unused parameter 'argv' > a.c: In function main': > a.c:7: warning: control reaches end of non-void function > a.c: At top level: > a.c:10: warning: return type defaults to int' > a.c: In function func': > a.c:13: warning: implicit declaration of function printf' > a.c:15: warning: control reaches end of non-void function > > Look at all those warnings from gcc! Good code should produce no > warnings. > > Among other MAJOR problems, you are passing four arguments to func() > when it only accepts one. >
