Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!drivax!frotz From: frotz@drivax.UUCP (Frotz) Newsgroups: comp.os.msdos.programmer Subject: Re: Returning a char* in Turbo C: Message-ID: <39AN2BS@drivax.UUCP> Date: 30 Jul 90 17:24:50 GMT References: <1990Jul30.050221.29945@caen.engin.umich.edu> Sender: frotz%drivax@uunet.uu.net Reply-To: frotz%drivax@uunet.uu.net Organization: Digital Research, Monterey CA Lines: 23 mrice@caen.engin.umich.edu (Michael Rice) writes: ] I wrote the following code to return a char* (a character pointer) ] to a string let's say "Michigan". I went through the debugger and ] the return value tempv->vname is correct but it returns something ] else something like "\eu\r4" which is gibberish to me. ] I am mainly calling it like this: ] printf("%s",findvolname(temp)); Try looking at the prototype definition before the printf(). I assume that this is either: a) in a separate module; or b) declared below the point where you are using it. Most likely the compiler is returning an int and you are trying to use it as a pointer. As a note, an external definition may be sufficient for return-types but is often not sufficient for parameter types. Try putting a full prototype for findvolname() in a header file and including that header file for all modules that use the function. -- Frotz