quicky but needy question....


 
Thread Tools Search this Thread
Top Forums Programming quicky but needy question....
# 1  
Old 03-19-2008
Data quicky but needy question....

int abc()
{
int a=2, b=1, sum, diff;
sum = a+b;
diff = a-b;


}


int main()
{
int sum, diff;

abc();

...
...
...

return 0;
}
-------------------------------
how can i pass the 2 values: sum & diff in abc() into main() when i call it ? Smilie thx.

Last edited by trapeze; 03-19-2008 at 02:00 AM..
# 2  
Old 03-19-2008
Power

Quote:
Originally Posted by trapeze
int abc()
{
int a=2, b=1, sum, diff;
sum = a+b;
diff = a-b;


}


int main()
{
int sum, diff;

abc();

...
...
...

return 0;
}
-------------------------------
how can i pass the 2 values: sum & diff in abc() into main() when i call it ? Smilie thx.
Code:
int abc(int *sum, int *diff)
{
  int a=2, b=1;
  *sum = a+b;
  *diff = a-b;

  return 0;
}


int main()
{
  int sum, diff;

  abc(&sum,&diff);

  return 0;
}

voila Smilie

Last edited by Yogesh Sawant; 03-19-2008 at 06:36 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

A question

Hi, I'm new to unix and got struck here.Can any one help me out.My question is .. is the command if ; then echo "do some stuff" fi correct? Thanks in advance abhijeet (18 Replies)
Discussion started by: Abhijeet_Atti
18 Replies

2. Programming

C++ little question

Hi, I am doing a C++ self-study and I got stuck with this problem. I want to have a code that asks the suer to enter two numbers and then it lists the numbers between these two numbers. It has also to print a message if these two numbers are equal. Here is what I wrote: #include <iostream>... (11 Replies)
Discussion started by: faizlo
11 Replies

3. UNIX for Dummies Questions & Answers

Help me these Question??

1. How the Unix system identify the Other User to access for file permission? 2. What command we use to convert the extension of a file name? 3. What command use to convert other editing file to Unix based text file? Please answer of these Question???Its necessary for me?? (3 Replies)
Discussion started by: pradipta_pks
3 Replies

4. UNIX for Dummies Questions & Answers

Vi Question

Hi Guys I have a quick question I have a file that is approx 1.5 million lines long of which most of the lines start with INFO: some info INFO: some more info INFO: etc I want to remove these lines I was thinking along the lines of :%s/INFO*//g but this does not work None... (6 Replies)
Discussion started by: grahambo2005
6 Replies

5. UNIX for Dummies Questions & Answers

Question

I need to write a script file that will tell me the largest number in a group of numbers. ANy help is greatly appreciated (2 Replies)
Discussion started by: twan
2 Replies

6. Shell Programming and Scripting

question

how do i write a script that'll open what i entered and scan it for a certain line of text. for example, i enter a filename (that exists) and in that file i want to scan a certain word that'll show how much of that word appears throughout the file. (2 Replies)
Discussion started by: mrhenry
2 Replies

7. UNIX for Dummies Questions & Answers

Question

hallo, ik heb hier een vraagje. hoeveel gebruikers kunnen er op 1 unix systeem. hopelijk antwoorden golle nu want ik moet da vinde voor school en die leerkracht zaagt. :p groetjes eu wacht wa was mijne nick ah ja vraagje groetjes vraagje ik kan geen engels dus antwoord liever in het... (1 Reply)
Discussion started by: vraagje
1 Replies

8. Linux

I have a question...

hello,I want to get a free linux(English).How to get it?? (2 Replies)
Discussion started by: Jerry_wang
2 Replies

9. UNIX for Dummies Questions & Answers

Next Question:

what is the function of swap in linux why i have to create apsolutely a particion for the swap when i install (i installed lnx4win mandrake and made an automat. disk particion and the install program one of my disk partitions that was 3gb devidet in 4 one native 700mb swap 600mb and the others i... (1 Reply)
Discussion started by: user666
1 Replies
Login or Register to Ask a Question