Stack ( Linked list ). Error C2440 cannot convert from...

Hi,
need help, I wrote a program with stack (linked list) with initialization, pushing and showing my stack. Problem with showing.
Here is my C++ code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "stdafx.h"

    struct STACK{
	    float Value;
	    STACK *Link;
    };

     struct Using_Stack{
	    STACK *New_Var;
	    void (*Init)(Using_Stack*);
	    void (*Push)(Using_Stack*, float );
	    void (*SHOW)(Using_Stack*);
     };

    /* INITIALIZATION  */
    void MyInit( Using_Stack* MyStack )
    {
	    MyStack->New_Var = NULL;
    }

    /* PUSH  */
    void MyPush( Using_Stack* MyStack, float Value )
    {
	    STACK *New_El;

	    New_El = new STACK;
	    New_El -> Value = Value;
	    New_El -> Link = MyStack -> New_Var;
	    MyStack -> New_Var = New_El;
    }

    /* SHOW  */
    void MySHOW( Using_Stack* MyStack )
    {
    	    STACK* MyStack2;
	    MyStack2 = MyStack -> New_Var;

	    float Showing;
	    while (MyStack2 -> Value != NULL)	  
	    {			
			Showing = MyStack2 -> Value;
			MyStack2 = MyStack2 -> Link;
			printf("%g\n", Showing);
	    }
    }

    void main()
    {
	    Using_Stack *MyStack;
	    MyStack = new Using_Stack;

	    MyStack -> Init = MyInit;
	    MyStack -> Push = MyPush;
	    MyStack -> SHOW = MySHOW;

	    MyStack -> Init(MyStack);	
	    MyStack -> Push(MyStack, 10.5);		
	    MyStack -> Push(MyStack, 20.5);

	    MyStack -> SHOW(MyStack);
    }

So, problem is that the program WORKING PROPERLY, but it shows an error when performing.
What I did wrong?
I will be grateful for the help.
1
2
//MySHOW()
while (MyStack2 -> Value != NULL)
makes no sense. You didn't put a sentinel on `Value'


Please read http://cplusplus.com/doc/tutorial/classes/

Also, main must return int
Topic archived. No new replies allowed.