473,505 Members | 15,976 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

void keyword

1 New Member
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
3 2272
sicarie
4,677 Recognized Expert Moderator Specialist
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
3,652 Recognized Expert Specialist
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
4,677 Recognized Expert Moderator Specialist
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

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

Similar topics

17
2631
by: codeslinger | last post by:
What is the point of the construct in the subject line? Why the use of two const labels? Does that do something different than const void *x? And what would void * const x indicate? Thanks in...
188
17197
by: infobahn | last post by:
printf("%p\n", (void *)0); /* UB, or not? Please explain your answer. */
3
4339
by: Scott | last post by:
Can anyone please give me a broef explanation of what the void keyword is for? What does it do? Do I need to use it? Thanks, Scott
2
3426
by: Marcus Kwok | last post by:
Is there a difference between using the C++ keyword "void" and using "System::Void" when specifying parameters and return types? Is there a preference when choosing between the two? In the code...
18
2105
by: Giannis Papadopoulos | last post by:
According to the standard (ISO C99 draft WG14/N1124), void is the incomplete type that cannot be completed and comprises the empty set of values. Since it declares the absense of a value can it be...
3
14474
by: vijay.gandhi | last post by:
Hi, I am trying to convert some unmanaged code (C++) to managed code (using C++/CLI). 1) One of the functions used returns a void* which I need to cast into a handle of a managed object. Can...
1
1370
by: SMH | last post by:
Hi All, I am currently making the switch from VB to C#. I understand that the VOID keyword allows creation of a function which doesnt require any parameters and doesn't return a value. Is...
26
521
by: eotcl | last post by:
Dear Group! Is it possible to dereference the void pointer to function pointer, and refer to this pointer later as if it was a function. Thanks.
28
2614
by: lovecreatesbeauty | last post by:
Is the keyword const necessary in the comparison function in qsort and bsearch? int (*compar)(const void *, const void *) If the pointer cannot be dereferenced why worry if the pointed object...
4
14264
by: ANURAGBAJPAI | last post by:
This is a question in my text book, and the answer is- The keyword void in a function declaration has a significant purpose.When the return type of a function is void , that means the function...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7021
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.