Newsgroups: comp.sys.ibm.pc.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!sharkey!math.lsa.umich.edu!caen!magnolia.engin.umich.edu!mrice From: mrice@caen.engin.umich.edu (Michael Rice) Subject: Returning a char* in Turbo C: Message-ID: <1990Jul30.050221.29945@caen.engin.umich.edu> Keywords: Turb Sender: news@caen.engin.umich.edu (CAEN Netnews) Organization: University of Michigan Engineering, Ann Arbor Date: Mon, 30 Jul 90 05:02:21 GMT 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)); where temp is a ENTRYPTR type... Any ideas what is wrong? I only have problems when I try to return char*, not when I return integers or floats.. Any help is appreciated... Here is the function: #include "prog.h" #include #include extern VOLUMEPTR topvollist; char *findvolname(enode) ENTRYPTR enode; { VOLUMEPTR vtemp; int done = 0; vtemp = topvollist->nextvolume; while(vtemp != NULL && !done) { if(vtemp->index == enode->volume_index) { done = 1; } else { vtemp = vtemp->nextvolume; } } return(vtemp->vname); }