Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have 2 functions in my code, namely void compare(...) and void checklist(...).
In void compare(...), I have if statement that has been defined as Reselection.
Now, I need to use the goto function from void checklist(...) to go to Reselection in void compare(...).
Since I know that the goto function can only be used within that function, I was wondering if there are other function that works as goto function but can be used in different void functions?
No, labels are local to the function in which they are defined. And programs would be a real mess otherwise.
You should make Reselection a function of its own.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 21 days ago.
Improve this question
is there a way to obtain function's parameters, inside this function, without passing it. Like the func providing the function name. i'd like to obtain just name of parameters, not type.
search with google, found functions for line, function name and file name but nothing about parameters
The C standard does not provide any facility for this.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I just had a question that whenever I write code I had to call all functions (predefined or user defined) in order to use or execute them. So why we don't have to call main function?
The main function is defined by the language itself as the designated start of the program. You don't need to call it because, in effect, your operating system (Linux, macOS, Windows, etc.) does.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm programming an OS.
So I want to know how can an expression like (2*(7+8)-9)+2 can be initialised into variable using user defined function like extract() :
extract(char a[])
{
//some code
}
char expr[] = "(2*(7+8)-9)+2";
int value = extract(expr);
I'm doing this for variable initialisation from string.( Any tips/ideas/suggestions? )
StackOverflow has already covered the topic of Infix expression parsing and Recursive Decent parsing using C++ here. Read it over to understand the algorithm, then see if you can convert it to C. That will definitely be "fun" and teach you a little bit about C along the way.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I was going through global and static variables.I have a question.
If I have a .c file and it is having only one user defined function(ABC()). Suppose I have to preserve the value of a variable in that function. Should I make that variable static(locally in that function) or make it global. Which one is best way and why.
Rule of thumb: Define variables/functions in the smallest scope possible while avoiding redundant code and data.
I recommend making the variable a static variable defined in the scope of the function.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am not sure how will this program behave?
I ran this code but I am not able to figure out any reasoning behind the way it works
int main()
{
return main();
}
main() is a function by itself. The line return main() calls the function again. So in effect it should run an infinite loop. You wouldn't get any output (you said you ran it. didn't it crash?).
In reality it would be like staring into a mirror with another mirror placed behind you. You would only see endless reflections. . :)