あいさつを表示するプログラムを作りました。このプログラムは正常に動作しますが、あと少し改善できる部分があります。
![](/wp-content/include/images/avatar/teacher/5.png)
どこが改善できるか分かりますか?
main.c
#include <stdio.h>
#include <stdlib.h>
void Greet(char *pName) {
printf("Hello, %s!\n", pName);
}
int main(void) {
Greet("Leo");
return EXIT_SUCCESS;
}
実行結果
Hello, Leo!
![](/wp-content/include/images/avatar/student/3.png)
あ、「Leo」って僕の名前じゃないですかぁ。
![](/wp-content/include/images/avatar/teacher/4.png)
うん。レオ君にあいさつするプログラムよ。
![](/wp-content/include/images/avatar/student/7.png)
Greet()
っていう関数に名前を渡すとあいさつが表示されるんですね!
![](/wp-content/include/images/avatar/teacher/6.png)
そのあたりで、ちょっとだけ手直ししておきたい箇所があるのが分かるかしら?
![](/wp-content/include/images/avatar/student/9.png)
問題なさそうに見えますけど……。まさか僕の名前がダメとか言いませんよね?
![](/wp-content/include/images/avatar/teacher/7.png)
Greet()
の引数の型に注目してみましょう。