#include <stdio.h>
#include <stdlib.h>
int main(){
char * name[5];
int i;
FILE * fp;
if((fp=fopen("05write_person.txt","w"))==NULL){
return 1;
}
for(i=0; i<5; i++){
printf("%d番目の人名を入力してください;", i+1);
*name = (char *) malloc(sizeof(char) * 10);
scnaf("%s", name[i]);
}
for(i=0; i<5; i++){
fprintf(fp, "%s", name[i]);
}
fclose(fp);
free(name);
printf("¥n入力した名前をファイルに入力しました。 ¥n");
}
今のところこののような形なのですが、以下のような初見のエラーが出てしまい、困っております。
warning: implicit declaration of function 'scnaf' is invalid in C99
[-Wimplicit-function-declaration]
scnaf("%s", name[i]);
^
1 warning generated.
Undefined symbols for architecture x86_64:
"_scnaf", referenced from:
_main in 6-3-98276b.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)