title: "Undeclared" value for value declared inside struct
body: <p>I'm trying to implement/understand stacks and I keep getting &quot;value undeclared&quot; for something that is declared inside the struct that is supposed to represent the stack</p>
  <pre><code>#define EmptyTOS ( -1 )
  #define MinStackSize ( 5 )
  
  typedef struct StackRecord *Stack;
  
  struct StackRecord
  {
      int Capacity;
      int TopOfStack;
      int *Array;
  };
  
  Stack CreateStack( int MaxElements )
  {
      Stack S;    
      S = malloc( sizeof( struct StackRecord ) );
      S-&gt;Array = malloc( sizeof( int ) * MaxElements );
      S-&gt;Capacity = MaxElements;
      MakeEmpty( S );
      return S;
  }
  
  void MakeEmpty( Stack S ){
      S-&gt;TopOfStack = EmptyTOS;
  }
  
  void Push( int X, Stack S ){
      S-&gt;Array[++TopOfStack] = X;
  }
  
  int main(){
  
      Stack s1 = CreateStack(10);
  
      return 0;
  }
  </code></pre>
  <p>If I try to compile just this I get: In function ‘Push’: error: ‘TopOfStack’ undeclared
  I don't understand why</p>