问题描述
我想做的是询问某人的名字,然后存储它,以便可以将其用于不同的脚本。这是我到目前为止所拥有的。
main.c
#include <stdio.h>
#include "functions.h"
int main()
{
printf("welcome to the dungeon crawler.\n");
//ask for the name//
printf("please state your name: ");
char name[100];
scanf("%s",name);
printf("hello %s.\n",name);
main2();
return 0;
}
main2.c
#include <stdio.h>
#include "functions.h"
int main2()
{
printf("%s\n",name);
return 0;
}
functions.h
#ifndef FUNCTIONS_H_INCLUDED
#define FUNCTIONS_H_INCLUDED
int name;
#endif // FUNCTIONS_H_INCLUDED
当我尝试运行它时,main2说(空)。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)