www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/08/16:54:37

Message-Id: <199711082153.QAA22413@delorie.com>
From: "sl" <SL AT usemail DOT com>
To: "DJGPP mailing list" <djgpp AT delorie DOT com>
Date: Sat, 08 Nov 97 16:58:25
Reply-To: "sl" <SL AT usemail DOT com>
MIME-Version: 1.0
Subject: Program with functions

Hi,

	I'm experiencing problems using functions. For the last while I've been using:

char *add(char *first, char*second)
{
  int result;
  result=first+second;
  return(result);
}

	Problem is that RESULT is a local variable and when you return it it gets destroyed before it reachs 
the caller (because it is a local variable and naturally all local variables are destroyed when the function is 
complete.) So, how am I suppose to make this function work? In reality, the REAL function I'm working on is:
"File.getname(BYTE mode)" whereby File is a class and getname() returns different components of the 
filename depending on MODE (i.e. name, extention, drive etc.)

Gili

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019