Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!orion.oac.uci.edu!ucivax!ucla-cs!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Simple ptr passing question Message-ID: <16159@smoke.brl.mil> Date: 15 May 91 21:35:01 GMT References: <24268@unix.SRI.COM> <13012@uhccux.uhcc.Hawaii.Edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 15 In article <13012@uhccux.uhcc.Hawaii.Edu> morrison@uhhacb.tmc.edu (Jay Morrison) writes: >The problem is that in C you always pass by reference, ... No, it's always pass by value, which agrees with the further description you gave. >Another common problem you may encounter is a returning a FILE* >structure from a routine which opens a file. In this situation you must >also use pointers to pointers. This even had my professor confused as >to what was happening!! (temporarily). The standard practice for such a function is to make the FILE* its return value, e.g. extern FILE *my_open( const char *name ); with a null pointer being returned when the function fails.