Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: variable number of strings passed to function - how? Message-ID: <1988Oct24.180933.17505@utzoo.uucp> Organization: U of Toronto Zoology References: <434@tutor.UUCP> <3533@ihuxz.ATT.COM> Date: Mon, 24 Oct 88 18:09:33 GMT In article <3533@ihuxz.ATT.COM> burris@ihuxz.ATT.COM (Burris) writes: >> I want to write a function that accepts a variable number of string >> arguments. What is a possible way to do this? > >In the C language arguments are placed on the stack in reverse order... No. In some C *implementations* they are placed on the stack in reverse order. In others they are placed on the stack in non-reverse order. In others they are passed in registers. In yet others, different types of arguments are passed in different kinds of registers. An implementation which uses registers will usually have to pass really big arguments on an in-memory stack anyway. And so on. Use or (current practice and ANSI-C-draft practise respectively); they are the *only* portable way to do this. -- The dream *IS* alive... | Henry Spencer at U of Toronto Zoology but not at NASA. |uunet!attcan!utzoo!henry henry@zoo.toronto.edu