fork download
  1. 課題7-2(下記に記載)で作成したリストで表現されたスタックに対して、pushを行う関数
  2. を作成せよ。push関数を呼び出す前と後でprint_stack_listを呼びだし、push関数が正常に動いている
  3. ことを確認せよ。
  4. (ヒント)push関数のプロトタイプ宣言はvoid push(struct data **top, char key);のようにする。
  5. (課題72
  6.  
  7. #include<stdio.h>
  8. #include<string.h>
  9. #include<stdlib.h>
  10.  
  11. struct data{
  12. char key;
  13. struct data *next;
  14. };
  15.  
  16. void print_stack_list(struct data *top);
  17.  
  18. int main() {
  19. struct data *top, *cur;
  20. char values[4] = {'a', 'b', 'c', 'd'};
  21. int i;
  22. top = NULL;
  23. for (i = 0; i < 4; i++) {
  24. cur = (struct data*)malloc(sizeof(struct data));
  25. if (cur == NULL) {
  26. printf("メモりが確保できませんでした。\n");
  27. return 1;
  28. }
  29. cur->key = values[i];
  30. cur->next = top;
  31. top = cur;
  32. }
  33. print_stack_list(top);
  34. return 0;
  35. }
  36.  
  37. void print_stack_list(struct data *top) {
  38. while (top != NULL) {
  39. printf("%c\n",top->key);
  40. top = top->next;
  41. }
  42. }
  43.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1: error: stray ‘\350’ in program
prog.cpp:1: error: stray ‘\252’ in program
prog.cpp:1: error: stray ‘\262’ in program
prog.cpp:1: error: stray ‘\351’ in program
prog.cpp:1: error: stray ‘\241’ in program
prog.cpp:1: error: stray ‘\214’ in program
prog.cpp:1: error: stray ‘\357’ in program
prog.cpp:1: error: stray ‘\274’ in program
prog.cpp:1: error: stray ‘\210’ in program
prog.cpp:1: error: stray ‘\344’ in program
prog.cpp:1: error: stray ‘\270’ in program
prog.cpp:1: error: stray ‘\213’ in program
prog.cpp:1: error: stray ‘\350’ in program
prog.cpp:1: error: stray ‘\250’ in program
prog.cpp:1: error: stray ‘\230’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\253’ in program
prog.cpp:1: error: stray ‘\350’ in program
prog.cpp:1: error: stray ‘\250’ in program
prog.cpp:1: error: stray ‘\230’ in program
prog.cpp:1: error: stray ‘\350’ in program
prog.cpp:1: error: stray ‘\274’ in program
prog.cpp:1: error: stray ‘\211’ in program
prog.cpp:1: error: stray ‘\357’ in program
prog.cpp:1: error: stray ‘\274’ in program
prog.cpp:1: error: stray ‘\211’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\247’ in program
prog.cpp:1: error: stray ‘\344’ in program
prog.cpp:1: error: stray ‘\275’ in program
prog.cpp:1: error: stray ‘\234’ in program
prog.cpp:1: error: stray ‘\346’ in program
prog.cpp:1: error: stray ‘\210’ in program
prog.cpp:1: error: stray ‘\220’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\227’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\237’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\203’ in program
prog.cpp:1: error: stray ‘\252’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\202’ in program
prog.cpp:1: error: stray ‘\271’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\203’ in program
prog.cpp:1: error: stray ‘\210’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\247’ in program
prog.cpp:1: error: stray ‘\350’ in program
prog.cpp:1: error: stray ‘\241’ in program
prog.cpp:1: error: stray ‘\250’ in program
prog.cpp:1: error: stray ‘\347’ in program
prog.cpp:1: error: stray ‘\217’ in program
prog.cpp:1: error: stray ‘\276’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\225’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\202’ in program
prog.cpp:1: error: stray ‘\214’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\237’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\202’ in program
prog.cpp:1: error: stray ‘\271’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\202’ in program
prog.cpp:1: error: stray ‘\277’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\203’ in program
prog.cpp:1: error: stray ‘\203’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\202’ in program
prog.cpp:1: error: stray ‘\257’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\253’ in program
prog.cpp:1: error: stray ‘\345’ in program
prog.cpp:1: error: stray ‘\257’ in program
prog.cpp:1: error: stray ‘\276’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\227’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\246’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\200’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\202’ in program
prog.cpp:1: error: stray ‘\222’ in program
prog.cpp:1: error: stray ‘\350’ in program
prog.cpp:1: error: stray ‘\241’ in program
prog.cpp:1: error: stray ‘\214’ in program
prog.cpp:1: error: stray ‘\343’ in program
prog.cpp:1: error: stray ‘\201’ in program
prog.cpp:1: error: stray ‘\206’ in program
prog.cpp:1: error: stray ‘\351’ in program
prog.cpp:1: error: stray ‘\226’ in program
prog.cpp:1: error: stray ‘\242’ in program
prog.cpp:1: error: stray ‘\346’ in program
prog.cpp:1: error: stray ‘\225’ in program
prog.cpp:1: error: stray ‘\260’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\202’ in program
prog.cpp:2: error: stray ‘\222’ in program
prog.cpp:2: error: stray ‘\344’ in program
prog.cpp:2: error: stray ‘\275’ in program
prog.cpp:2: error: stray ‘\234’ in program
prog.cpp:2: error: stray ‘\346’ in program
prog.cpp:2: error: stray ‘\210’ in program
prog.cpp:2: error: stray ‘\220’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\233’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\202’ in program
prog.cpp:2: error: stray ‘\210’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\200’ in program
prog.cpp:2: error: stray ‘\202’ in program
prog.cpp:2: error: stray ‘\351’ in program
prog.cpp:2: error: stray ‘\226’ in program
prog.cpp:2: error: stray ‘\242’ in program
prog.cpp:2: error: stray ‘\346’ in program
prog.cpp:2: error: stray ‘\225’ in program
prog.cpp:2: error: stray ‘\260’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\202’ in program
prog.cpp:2: error: stray ‘\222’ in program
prog.cpp:2: error: stray ‘\345’ in program
prog.cpp:2: error: stray ‘\221’ in program
prog.cpp:2: error: stray ‘\274’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\263’ in program
prog.cpp:2: error: stray ‘\345’ in program
prog.cpp:2: error: stray ‘\207’ in program
prog.cpp:2: error: stray ‘\272’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\231’ in program
prog.cpp:2: error: stray ‘\345’ in program
prog.cpp:2: error: stray ‘\211’ in program
prog.cpp:2: error: stray ‘\215’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\250’ in program
prog.cpp:2: error: stray ‘\345’ in program
prog.cpp:2: error: stray ‘\276’ in program
prog.cpp:2: error: stray ‘\214’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\247’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\202’ in program
prog.cpp:2: error: stray ‘\222’ in program
prog.cpp:2: error: stray ‘\345’ in program
prog.cpp:2: error: stray ‘\221’ in program
prog.cpp:2: error: stray ‘\274’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\263’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\240’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\227’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\200’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\351’ in program
prog.cpp:2: error: stray ‘\226’ in program
prog.cpp:2: error: stray ‘\242’ in program
prog.cpp:2: error: stray ‘\346’ in program
prog.cpp:2: error: stray ‘\225’ in program
prog.cpp:2: error: stray ‘\260’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\214’ in program
prog.cpp:2: error: stray ‘\346’ in program
prog.cpp:2: error: stray ‘\255’ in program
prog.cpp:2: error: stray ‘\243’ in program
prog.cpp:2: error: stray ‘\345’ in program
prog.cpp:2: error: stray ‘\270’ in program
prog.cpp:2: error: stray ‘\270’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\253’ in program
prog.cpp:2: error: stray ‘\345’ in program
prog.cpp:2: error: stray ‘\213’ in program
prog.cpp:2: error: stray ‘\225’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\204’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\246’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\201’ in program
prog.cpp:2: error: stray ‘\204’ in program
prog.cpp:2: error: stray ‘\343’ in program
prog.cpp:2: error: stray ‘\202’ in program
prog.cpp:2: error: stray ‘\213’ in program
prog.cpp:3: error: stray ‘\343’ in program
prog.cpp:3: error: stray ‘\201’ in program
prog.cpp:3: error: stray ‘\223’ in program
prog.cpp:3: error: stray ‘\343’ in program
prog.cpp:3: error: stray ‘\201’ in program
prog.cpp:3: error: stray ‘\250’ in program
prog.cpp:3: error: stray ‘\343’ in program
prog.cpp:3: error: stray ‘\202’ in program
prog.cpp:3: error: stray ‘\222’ in program
prog.cpp:3: error: stray ‘\347’ in program
prog.cpp:3: error: stray ‘\242’ in program
prog.cpp:3: error: stray ‘\272’ in program
prog.cpp:3: error: stray ‘\350’ in program
prog.cpp:3: error: stray ‘\252’ in program
prog.cpp:3: error: stray ‘\215’ in program
prog.cpp:3: error: stray ‘\343’ in program
prog.cpp:3: error: stray ‘\201’ in program
prog.cpp:3: error: stray ‘\233’ in program
prog.cpp:3: error: stray ‘\343’ in program
prog.cpp:3: error: stray ‘\202’ in program
prog.cpp:3: error: stray ‘\210’ in program
prog.cpp:3: error: stray ‘\343’ in program
prog.cpp:3: error: stray ‘\200’ in program
prog.cpp:3: error: stray ‘\202’ in program
prog.cpp:4: error: stray ‘\357’ in program
prog.cpp:4: error: stray ‘\274’ in program
prog.cpp:4: error: stray ‘\210’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\203’ in program
prog.cpp:4: error: stray ‘\222’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\203’ in program
prog.cpp:4: error: stray ‘\263’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\203’ in program
prog.cpp:4: error: stray ‘\210’ in program
prog.cpp:4: error: stray ‘\357’ in program
prog.cpp:4: error: stray ‘\274’ in program
prog.cpp:4: error: stray ‘\211’ in program
prog.cpp:4: error: stray ‘\351’ in program
prog.cpp:4: error: stray ‘\226’ in program
prog.cpp:4: error: stray ‘\242’ in program
prog.cpp:4: error: stray ‘\346’ in program
prog.cpp:4: error: stray ‘\225’ in program
prog.cpp:4: error: stray ‘\260’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\201’ in program
prog.cpp:4: error: stray ‘\256’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\203’ in program
prog.cpp:4: error: stray ‘\227’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\203’ in program
prog.cpp:4: error: stray ‘\255’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\203’ in program
prog.cpp:4: error: stray ‘\210’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\202’ in program
prog.cpp:4: error: stray ‘\277’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\202’ in program
prog.cpp:4: error: stray ‘\244’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\203’ in program
prog.cpp:4: error: stray ‘\227’ in program
prog.cpp:4: error: stray ‘\345’ in program
prog.cpp:4: error: stray ‘\256’ in program
prog.cpp:4: error: stray ‘\243’ in program
prog.cpp:4: error: stray ‘\350’ in program
prog.cpp:4: error: stray ‘\250’ in program
prog.cpp:4: error: stray ‘\200’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\201’ in program
prog.cpp:4: error: stray ‘\257’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\201’ in program
prog.cpp:4: error: stray ‘\256’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\202’ in program
prog.cpp:4: error: stray ‘\210’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\201’ in program
prog.cpp:4: error: stray ‘\206’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\201’ in program
prog.cpp:4: error: stray ‘\253’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\201’ in program
prog.cpp:4: error: stray ‘\231’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\202’ in program
prog.cpp:4: error: stray ‘\213’ in program
prog.cpp:4: error: stray ‘\343’ in program
prog.cpp:4: error: stray ‘\200’ in program
prog.cpp:4: error: stray ‘\202’ in program
prog.cpp:5: error: stray ‘\357’ in program
prog.cpp:5: error: stray ‘\274’ in program
prog.cpp:5: error: stray ‘\210’ in program
prog.cpp:5: error: stray ‘\350’ in program
prog.cpp:5: error: stray ‘\252’ in program
prog.cpp:5: error: stray ‘\262’ in program
prog.cpp:5: error: stray ‘\351’ in program
prog.cpp:5: error: stray ‘\241’ in program
prog.cpp:5: error: stray ‘\214’ in program
prog.cpp:5: error: stray ‘\343’ in program
prog.cpp:5: error: stray ‘\203’ in program
prog.cpp:5: error: stray ‘\274’ in program
prog.cpp:5: error: stray ‘\357’ in program
prog.cpp:5: error: stray ‘\274’ in program
prog.cpp:5: error: stray ‘\211’ in program
prog.cpp:1: error: expected unqualified-id before numeric constant
prog.cpp:5: error: expected unqualified-id before numeric constant
stdout
Standard output is empty