Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!tgr!ART@acc.ARPA From: ART@acc.ARPA (Art Berggreen) Newsgroups: net.lang.c Subject: RE: Function argument question Message-ID: <555@brl-tgr.ARPA> Date: Thu, 8-Aug-85 19:56:50 EDT Article-I.D.: brl-tgr.555 Posted: Thu Aug 8 19:56:50 1985 Date-Received: Sun, 11-Aug-85 07:00:48 EDT Sender: news@brl-tgr.ARPA Lines: 37 > I have a quick question which should be easy for some "C" expert > out there, I want to write a function which takes a character pointer > as an input, processes the string, returns an integer AND! updates the > string pointer in the process. Thanks, One way to approach this is to pass a pointer to the char pointer in the function call. You can then update the char pointer before the function returns, and the return value of the function can be the integer. e.g. int cnt; char *cp; . . cnt = foo(&cp); . . } foo(acp) char **acp; { int val; char *cp = *acp; /* use cp to ref string */ . *acp += val; . return(val); } "Art Berggreen"------