fork download
  1. #include <stdio.h>
  2.  
  3. // これらの関数はどう実装すればいいかわからない。
  4. int get_from_func1(); // func1から文字を受け取る。
  5. int get_from_func2(); // func2から文字を受け取る。
  6. void put_to_func2(int c); // func2に文字を送る。
  7. void put_to_func3(int c); // func3に文字を送る。
  8.  
  9. // func2に文字を送る。
  10. // 終了の合図にヌルを送る。
  11. void func1() {
  12. put_to_func2('a');
  13. put_to_func2('b');
  14. put_to_func2('c');
  15. put_to_func2('\0');
  16. }
  17.  
  18. // func1から文字を受け取り、変更してfunc3に送る。
  19. // ヌルを受け取ったら終わる。
  20. void func2() {
  21. int c;
  22. do {
  23. c = get_from_func1();
  24. if (c) c += 1;
  25. put_to_func3(c);
  26. } while (c);
  27. }
  28.  
  29. // func2から文字を受け取り、表示する。
  30. // ヌルを受け取ったら終わる。
  31. void func3() {
  32. int c;
  33. do {
  34. c = get_from_func2();
  35. if (c) putchar(c);
  36. } while (c);
  37. }
  38.  
  39. int main() {
  40. // 3つの関数を一緒に実行して、"bcd"と表示させたい。
  41. return 0;
  42. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /home/tZchTy/ccNejSok.o: in function `func1':
prog.c:(.text+0xa): undefined reference to `put_to_func2'
/usr/bin/ld: prog.c:(.text+0x14): undefined reference to `put_to_func2'
/usr/bin/ld: prog.c:(.text+0x1e): undefined reference to `put_to_func2'
/usr/bin/ld: /home/tZchTy/ccNejSok.o: in function `func2':
prog.c:(.text+0x3b): undefined reference to `get_from_func1'
/usr/bin/ld: prog.c:(.text+0x56): undefined reference to `put_to_func3'
/usr/bin/ld: /home/tZchTy/ccNejSok.o: in function `func3':
prog.c:(.text+0x67): undefined reference to `get_from_func2'
/usr/bin/ld: /home/tZchTy/ccNejSok.o: in function `func1':
prog.c:(.text+0x29): undefined reference to `put_to_func2'
/usr/bin/ld: /home/tZchTy/ccNejSok.o: in function `func2':
prog.c:(.text+0x47): undefined reference to `put_to_func3'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty