+1

Can someone help me why it wants popen and putch ,when i use pop and push?

stack implementation using switch https://code.sololearn.com/c8DO6ClGWviV/?ref=app

4/20/2019 8:14:11 PM

Abhay

10 Answers

New Answer

+5

The problem is that the C compiler requires all functions to be declared before their use. This might not be familiar to somebody who is more comfortable with modern languages, but was used to speed up compiler speeds. In order to do this, you must put a function definition of each of your functions at the top of your .c file. Each functions has two parts: the declaration and the definition. A function declaration looks like this: return_type name(arguments); A function definition looks like this: return_type name(arguments) { //do stuff } The function definition is placed at the top of your code to basically just tell the compiler "Hey! I'm planning on using this function later in my code. Remember this for later". Then, later, when the compiler finds you using that function in your code, it can know if you used the right number of arguments, or the correct return type, etc. without even having to look at what the function actually does! tl;dr put these three lines of code at the top of your file and you should be good to go (although I did notice a few other bugs which you might want to take a look at) void push(); void pop(); void display(); Hope this was helpful!

+2

Abhay i made a mistake sorry for that😅

+1

that's switch while statement only ,I am confused where am I wrong 🤔

+1

Mind To Machine 💻🕆 yaa lol ,so. :-)

+1

Jack McCarthy ,thks a lot ,I was wondering if I should put that since switch statement had them already ,that cleared major errors :-)

+1

Mind To Machine 💻🕆 no worries but that really had me worried more lol

+1

Abhay your code might not work well on soloearn as its kind of an interactive program, but sololearn doestn support that

+1

Mind To Machine 💻🕆 yaa I can understand, ty

0

Mind To Machine 💻🕆 can you pls help me on how should I have input ?I am trying but it gives 0 just , I tried this way 1 5 y 1 7 y 3 n

0

Jack McCarthy can you pls help me on how should I have input ?I am trying but it gives 0 just , I tried this way 1 5 y 1 7 y 3 n