First of all, i couldn't use "code sample" therefore i am adding my codes as stated below:

**Header.h**

```
    #ifndef MYHEADER_H
    #define MYHEADER_H

    #define EMPTY_TOS -1
    #define MIN_STACK_SIZE 5
    #define FALSE 0
    #define TRUE 1

    struct Node;
    typedef struct Node *Stack;

    void *PopStack(Stack);
    void *TopOfStack(Stack);
    void PushStack(void *val, Stack); 
    int IsEmptyStack(Stack);
    int IsFullStack(Stack);

    #endif 

```

**Header.c**

```
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <math.h>
    #include "myheader.h"

    #define EMPTY_TOS -1 
    #define MIN_STACK_SIZE 5
    #define FALSE 0
    #define TRUE 1

    struct Node
    {
        void *val; 
        struct Node *next;
    };

    void PushStack(void *x, Stack s)
    {
         printf("/n a1");
        struct Node *insert;
               printf("/n a2");
        insert = (struct Node *) malloc(sizeof(struct Node));
               printf("/n a3");

        if (insert == NULL)
               printf("Out of memory space!\n");
        else
        {      printf("\n a4");
               insert->val = x;printf("\n a5");
               insert->next= s;printf("\n a6");
               s = insert;printf("\n a7");
        }
        printf("\n a8");
    }

    void *PopStack(Stack s)
    {                    printf("\n pop1");
        struct Node *remove; printf("\n pop2");
        void *val;           printf("\n pop3");

        if (IsEmptyStack(s))
        {
               printf("\nThe stack is empty!\n");
        }
        else   
        {      printf("\n pop4");
               remove = s;       printf("\n pop5");
               val = remove->val;     printf("\n pop67");
               s = s->next;      printf("\n pop7");
               free(remove);     printf("\n pop8");
        }
        return val;              printf("\n pop9");
    }

    void *TopOfStack(Stack s)
    {
        if (!IsEmptyStack(s))
               return s->next->val;
        else
        {
               printf("\nThe stack is empty\n");
               return 0;
        }

    }

    int IsEmptyStack(Stack s)
    {
        printf("empty");
        return (s == NULL);
    }

    int IsFullStack(Stack s)
    {
        return FALSE;
    }

```

**Project.cpp**

```
int main()
{

 Stack S = NULL;
 int x = 5;
 PushStack((void *)x, S);
 int z = (int)PopStack(S);
 printf("\n z = %d \n", z);

 system("PAUSE");
 return 0;
}

```

EDIT: I want to put X, into S(tack) by using PushStack function. And then i want to take the value(5) stored in S and print it as Z which is an integer. But i see a numbers like 4247612, which does not change as long as the compiler window is not closed.