+ 1
[SOLVED] Why i can't increase value of a variable here?
I am beginner in C please help me! I am creating a stack and storing value in it using push() function.. but I am facing error here is my code : https://code.sololearn.com/ce18a6A1c9vi/?ref=app
3 Respostas
+ 8
The top variable is local to the main() function. It needs to be outside main() to be useable by other functions. You're also not adding anything to the stack array inside push().
+ 6
What input or output you are expecting from program ? Also top isn't declared in is_full and push function .
Declare it globally as int top outside main so it can be accessed by other functions if you don't wanna pass it as argument.
Also "void push();" in your main function isn't how you call function ,just use push();
And remember to pass argument to push function as it expects one .