[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Wed, 07 Jan 2004 15:33:46 +0000 
Subject:Re: Procedures 
From:Chris Dollin 
Volume-ID:1040107.02 

jattdemush wrote:

> How do i get an individual variable from one long procedure and use it in
> another??

Redesign your code.

I'm serious; wanting to do this is a mistake often enough that it's
a good clue that you should restructure your code.

In your other message you exampled:
 
    define number();
    lvars input;
    readline -> input;
    
(presumably you meant "readline() -> input;")

    input=>
    66 -> price;              (i want to use this value below)
    enddefine; 

    define useprice()
    I WANT TO USE THE VALUE 'PRICE' HERE!!!!!

Make "number" return the price-value and use it when you call "number".
You may choose to store it in a variable at that point; what you don't
do (because experience suggests it leads to fragile code) is to
update global variables willy-nilly in random procedures.

-- 
Chris "electric hedgehog" Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html
C welcome: http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html