title: Stack - Linked list implementation - string not being used correctly
body: <p>I have made a stack in C, using the linked list implementation. I'm having trouble with when I try to input string. In each node I push to the stack, the string in all nodes are equal to the value of the string of the top node.
  For example:</p>
  
  <p>push->
  row:9
  seatletter:a
  name: fsda</p>
  
  <p>push->
  row:3
  seatletter:f
  name: jfjfjjf</p>
  
  <p>pop &lt;-
  row:3
  seatletter:f
  name: jfjfjjf</p>
  
  <p>pop&lt;-
  row:9
  seatletter:a
  name: jfjfjjf</p>
  
  <hr>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  typedef struct {
      int rowNumber;
      char seat;
      char* passengerName;
      struct passengerNode* nextPtr;
  } PassengerStack, *PassengerStackPtr;
  
  // prototypes
  void top(PassengerStackPtr* topPtr);
  void push(PassengerStackPtr* topPtr, int rowNum, char seatLetter, char passengersName[]);
  PassengerStackPtr pop(PassengerStackPtr* topPtr);
  void printStack(PassengerStackPtr currentPtr);
  int full(PassengerStackPtr topPtr);
  int empty(PassengerStackPtr topPtr);
  
  int main(void)
  {
  
      PassengerStackPtr passPtr = NULL;
      int choice;
      int rowNumber;
      char seat;
      char passengerName[50];
  
      printf("Enter choice: \n1 to show the first passenger in the stack. \n2 to push a passenger in the stack. \n3 to "
             "pop off a passenger in the stack. \n4 to print the stack. \n5 to exit the program.");
      scanf("%d", &amp;choice);
  
      while(choice != 5) {
  
      switch(choice) {
  
      case 1:
  
          top(passPtr);
          break;
  
      case 2:
  
          printf("\nEnter a row number: ");
          scanf("%d", &amp;rowNumber);
  
          printf("\nEnter a seat letter: ");
          scanf("%c", &amp;seat);
          scanf("%c", &amp;seat); //skips over if I don't duplicate (don't know why)
  
          printf("\nEnter a name for the passenger: ");
          scanf("%s", &amp;passengerName);
  
          printf("Entered: \n");
          printf("%d", rowNumber);
          printf("\n");
          printf("%c", seat);
          printf("\n");
          printf("%s", passengerName);
          printf("\n");
  
          push(&amp;passPtr, rowNumber, seat, passengerName);
          break;
  
      case 3:
  
          if(!empty(passPtr)) {
  
          PassengerStackPtr poppedPtr = pop(&amp;passPtr); 
          printf("%d", poppedPtr-&gt;rowNumber);
          printf("\n");
          printf("%c", poppedPtr-&gt;seat);
          printf("\n");
          printf("%s", poppedPtr-&gt;passengerName);
  
          printf("\n");
          }
          break;
  
      case 4:
  
          printStack(passPtr);
          break;
  
      case 5:
  
          // add exit here !!!!!!!!!!
          break;
  
      default:
  
          printf("Invalid choice.\n\n");
          break;
      }
      printf("Enter a choice: ");
      scanf("%d", &amp;choice);
      }
      printf("End of run.\n");
      return 0;
  }
  
  void push(PassengerStackPtr* topPtr, int rowNum, char seatLetter, char* passengersName)
  {
  
      PassengerStackPtr newPtr;
  
      newPtr = malloc(sizeof(PassengerStackPtr));
  
      if(newPtr != NULL) {
      newPtr-&gt;rowNumber = rowNum;
      newPtr-&gt;seat = seatLetter;
      newPtr-&gt;passengerName = passengersName;
      newPtr-&gt;nextPtr = *topPtr;
      *topPtr = newPtr;
      } else {
      printf("not inserted. No memory available.\n");
      }
  }
  
  PassengerStackPtr pop(PassengerStackPtr* topPtr)
  {
  
  
      PassengerStackPtr tempPtr;
  
      tempPtr = *topPtr;
      *topPtr = (*topPtr)-&gt;nextPtr;
      return tempPtr;
      free(tempPtr);
  }
  
  void top(PassengerStackPtr* topPtr)
  {
  }
  
  void printStack(PassengerStackPtr currentPtr)
  {
  
      if(currentPtr == NULL) {
      printf("The stack is empty.\n\n");
      } else {
      printf("The stack is:\n");
      while(currentPtr != NULL) {
          printf("%d --&gt; ", currentPtr-&gt;rowNumber);
          printf("%c --&gt; ", currentPtr-&gt;seat);
          printf("%s --&gt; ", currentPtr-&gt;passengerName);
          currentPtr = currentPtr-&gt;nextPtr;
      }
      printf("NULL\n\n");
      }
  }
  
  int full(PassengerStackPtr topPtr)
  {
  }
  
  int empty(PassengerStackPtr topPtr)
  {
  
      return topPtr == NULL;
  }
  </code></pre>