#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct data{
  char key;
  struct data *next;
};

void print_stack_list(struct data *top);
  

int main()
{
 
  struct data *top, *cur;
 
 
  cur = top;
 top = (struct data*)malloc(sizeof(struct data));
  if(top == NULL){printf("メモりが確保できませんでした。\n"); return 1;     }
  top->key = 'a';
  top->next = (struct data*)malloc(sizeof(struct data));
if(top->next == NULL){printf("メモりが確保できませんでした。\n"); return 1;        }
 top = top->next;

  top->key = 'b';
  top->next = (struct data*)malloc(sizeof(struct data));
  if(top->next == NULL){printf("メモりが確保できませんでした。\n"); 
    return 1;     }
  top = top->next;
 
  top->key = 'c';
  top->next = NULL;
  top = cur;
 
 print_stack_list(top);




  return 0;
 
}

void print_stack_list(struct data *top)
{
  
  while(top !=NULL)
    {

      printf("%c\n",top->key);
  
      top = top->next;
}
 





}
