From: Visionary Newsgroups: comp.os.msdos.djgpp Subject: Help - Are these pointer quirks unique to C++ or my compiler? Date: Tue, 30 Dec 1997 21:34:03 -0800 Organization: Bell Solutions Lines: 44 Message-ID: <34A9D94B.7A3D@ns.sympatico.ca> Reply-To: visionary AT ns DOT NO_SPAMsympatico DOT ca NNTP-Posting-Host: 142.177.28.98 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Here is a snippet of C++ code I have using the DJGPP compiler. This is the constructor definition for the class "investment". It works just fine as shown below: investment::investment(float initialAmount, float percentInterestRate, float monthlyWithdrawl, char compoundMode, char monthlyOrYearlyBalance, int numberYears) { char *newCompoundMode, tempCompoundMode; newCompoundMode = 0; tempCompoundMode = compoundMode; newCompoundMode = strlwr(&tempCompoundMode); . . . } Also, in my main program, I call this constructor with: investment dadInvestment(23454.67, 9.2, 544.55, 'U', 'N', 2); Why is it, however, that if I declare my local char variables in the reverse order like: char tempCompoundMode, *newCompoundMode; I get a memory segmentation/GPF type of fault when I run it, but not when I declare them in the other order? Is it because we must always put pointers ahead of regular variables in a certain type declaration? Also, I couldn't use the parameter "compoundMode" directly as in: newCompoundMode = strlwr(&compoundMode); This gives me the above mentioned crash and burn as well. Any ideas on either of these two weird quirks?