+ 3

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

20th Apr 2019, 8:14 PM
Abhay
Abhay - avatar
10 Respostas
+ 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!
20th Apr 2019, 8:47 PM
Jack McCarthy
Jack McCarthy - avatar
+ 4
Abhay i made a mistake sorry for that😅
20th Apr 2019, 9:05 PM
Mind To Machine đŸ’»đŸ•†
Mind To Machine đŸ’»đŸ•† - avatar
+ 3
Abhay your code might not work well on soloearn as its kind of an interactive program, but sololearn doestn support that
20th Apr 2019, 10:16 PM
Mind To Machine đŸ’»đŸ•†
Mind To Machine đŸ’»đŸ•† - avatar
+ 1
that's switch while statement only ,I am confused where am I wrong đŸ€”
20th Apr 2019, 8:45 PM
Abhay
Abhay - avatar
20th Apr 2019, 8:58 PM
Abhay
Abhay - avatar
+ 1
Jack McCarthy ,thks a lot ,I was wondering if I should put that since switch statement had them already ,that cleared major errors :-)
20th Apr 2019, 9:01 PM
Abhay
Abhay - avatar
+ 1
Mind To Machine đŸ’»đŸ•† no worries but that really had me worried more lol
20th Apr 2019, 9:20 PM
Abhay
Abhay - avatar
+ 1
Mind To Machine đŸ’»đŸ•† yaa I can understand, ty
20th Apr 2019, 10:20 PM
Abhay
Abhay - avatar
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
20th Apr 2019, 9:33 PM
Abhay
Abhay - avatar
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
20th Apr 2019, 9:54 PM
Abhay
Abhay - avatar