By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,819 Members | 1,173 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,819 IT Pros & Developers. It's quick & easy.

void keyword

P: 1
Hello to all,
I am a trying really hard to understand keywords for a rerort I have to make for my university but I don't seem to get the main idea....
There is a question and if you have any ideas there are all very very wellcome:
Whitch yould be the outcome after operating the func3 ( ), Explain ???
Expand|Select|Wrap|Line Numbers
  1. void func1 (int a)
  2. {
  3.               a=10;
  4. }
  5. int func2 (int a)
  6. {
  7.               a=10;
  8.               return (a);
  9. }
  10. void func3 ( )
  11. {
  12.               int a=2;
  13.               int b=5;
  14.  
  15.               func1 (a);
  16.               b=func2 (a);
  17.               printf("a=%d,  b=%d\n", a, b);
  18. }
  19.  
Best Regards from Greece
Filitsa
Mar 13 '07 #1
Share this Question
Share on Google+
3 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
Hello to all,
I am a trying really hard to understand keywords for a rerort I have to make for my university but I don't seem to get the main idea....
There is a question and if you have any ideas there are all very very wellcome:
Whitch yould be the outcome after operating the func3 ( ), Explain ???
Expand|Select|Wrap|Line Numbers
  1. void func1 (int a)
  2. {
  3.               a=10;
  4. }
  5. int func2 (int a)
  6. {
  7.               a=10;
  8.               return (a);
  9. }
  10. void func3 ( )
  11. {
  12.               int a=2;
  13.               int b=5;
  14.  
  15.               func1 (a);
  16.               b=func2 (a);
  17.               printf("a=%d,  b=%d\n", a, b);
  18. }
  19.  
Best Regards from Greece
Filitsa
Ok, so this is a pretty basic example - what were you thinking about this one? Did you try to trace through it with a value? (Hint, assign arbitrarily small values to a and b and move through each line yourself)
Mar 13 '07 #2

Ganon11
Expert 2.5K+
P: 3,652
There's no point in assigning arbitrary values to a and b - they are given values in the first two lines of func3. Knowing what you know about scope and functions, step through the program and find out what answers will be.
Mar 13 '07 #3

sicarie
Expert Mod 2.5K+
P: 4,677
There's no point in assigning arbitrary values to a and b - they are given values in the first two lines of func3. Knowing what you know about scope and functions, step through the program and find out what answers will be.
Haha, ah, I feel like an idiot... :(
Mar 13 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.