Question:
A C++/C language doubt...?
Fizix
2010-07-05 06:03:59 UTC
This is a doubt relating function calling in C or C++.

Is there any syntax of calling a library-defined function from a user defined function, except main().

For example, I have a user defined function user() and need to call a library defined function, say lib(). Now as I found, it is possible to call lib() directly from main(), but calling it from user() shows compilation errors.

Isn't there some technique to call lib() directly from user()? Please reply.


PS: lib() and user() are hypothetical functions, mentioned just for explaining the situation.
Three answers:
The Cool!
2010-07-07 03:01:23 UTC
You probably made some mistake while writing the program.



What all you wrote above seems correct.



EDIT(next day):

I compiled the program your way (by using functions) and it worked very well. I think there must have been some typing error on your part while including the LCD header file. Check it again. The logic certainly isn't wrong. There might be some mistake with the commands or header file.



All the best.
Ratchetr
2010-07-05 06:13:06 UTC
You can call a library function from anywhere, not just main.



Without knowing what the error message is, it's hard to guess what you are doing wrong.



Did you include the appropriate header file for the library?

If C++, are you using the proper namespace for the library?

Are you passing the right number and type of arguments to the function?



If that doesn't help, post the error message.
Someee
2010-07-05 06:11:37 UTC
you can use the 'goto' statement, to transfer the control into the main() function.....use the command back (along with help of 'if' statement) if u get some value in your reference variable.....hope it does the trick..


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...