Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 11-12-2007, 09:40 AM   #1 (permalink)
 
True Techie

Join Date: Apr 2006

Posts: 219

IfYouHaveToAsk

Default (Easy) C Question

Hi im in the process of learning C and there is one thing that I want to know and cant seem to find in any books or online (i dont really know the terminology that well)

basically say i have my main function which calls 2 functions. In the example below, presume function1 returns an integer. how can I get this integer to be passed as an argument in function 2.

main()
{
function1(x,y)
function2(z)
}

e.g. i want z to be the result of function 1.

I know I could just call function 2 from within function 1 but this gets messy when you have lots of functions.

would global variables work?
__________________
AMD 3000+
2gb RAM
X800 PCI-e
80gb + 250gb WD HDDs
X-FI Xtreme Music
DVD/CD-RW Drive
IfYouHaveToAsk is offline  
Old 11-12-2007, 10:20 AM   #2 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default Re: (Easy) C Question

Code:
int z = function1(x,y);
function2(z);

jaeusm is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy Question About New Computer Slave2Society7 Building, Buying, or Upgrading High Performance PC Systems 11 09-23-2007 01:19 PM
Power Supply Question + Overclocking Question Grievearz Building, Buying, or Upgrading High Performance PC Systems 21 09-12-2007 12:59 AM
Probably a easy question. KCRMYZ Computer Audio & Multimedia 1 08-10-2007 08:44 AM
Getting into College Question vernong1992 Off Topic Discussion 16 07-28-2007 11:36 PM
Ram OC question zetahammy Overclocking, Case Mod, Tweaking PC Performance 0 06-16-2007 01:18 AM