Stack Exchange
error expected expression before "STACK"
typedef struct student *std_ptr;

   struct student
    {
        int number;
        std_ptr next;
    };
    typedef std_ptr STACK;

    create_stack(void)
    {
        STACK S;
        S = (STACK) malloc( sizeof( struct student ) );

        if(S == NULL) printf("out of space!");
        return S;
    }

    void push(int x, STACK S)
    {
        std_ptr tmp;
        tmp = (std_ptr) malloc(sizeof(struct student));

        if(tmp == NULL) printf("out of space!");

        else
        {
            tmp -> number = x;
            tmp -> next = S -> next;
            S -> next = tmp;
        }
    }

    int main()
    {
        push(12058010,STACK S);
        return 0;
    }

Im trying to call function and I get error: expected expression before stack.I also tried to call the function like that
    int main()
    {
        push(12058010,S);
        return 0;
    }

This time I get error: 'S' undeclared(first use in this function)
Thank you for your help!

You are in the most serious need of reading a beginner C book or tutorial.

Your text on how to write a function and declare its parameters surely has an example of how to invoke that function.


Define the variable s by doing:
STACK s;

Initialise it: 
s = create_stack();

Test whether the initialisation succeeded:
if (NULL == s)
{
  return EXIT_FAILURE;
}

Use it by calling push() like this:
push(12058010, s);


All together this could look like this:
int main(void)
{   
    STACK s = create_stack(); /* This merges step 1 and 2. */
    if (NULL == s)
    {
      return EXIT_FAILURE;
    }
    push(12058010, s);
    return EXIT_SUCCES;
}


Also, function create_stack() should declare its return type: STACK create_stack() or else it defaults to int.

S is neither in the global scope nor in the scope of main().
I suspect you meant to write STACK S = create_stack(); as the first statement in main().
Don't forget to free the allocated memory as well.
