#include
int main() {
char *colour[5];
colour[0] = "red";
colour[1] = "yellow";
colour[2] = "green";
colour[3] = "blue";
colour[4] = "pink";
return 0;
}
//請問這種方法對不對?
//如果想用鍵盤輸入(scanf),該怎麼定義?
#include <stdio.h>
#include <stdlib.h>
int main()
{
char ** color = (char **)malloc(5 * sizeof (char *));
for (int i = 0; i < 5; i++)
{
color[i] = (char *)malloc(100 * sizeof (char));
scanf("%s", color[i]);
}
for (int i = 0; i < 5; i++)
printf("%s", color[i]);
}