为什麽指针没有传递过去,请大虾指点
// 为什麽question1,answer没有传递过去,请大虾指点#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>
#include<windows.h>
#include <string.h>
#define michael while(getchar()!='\n') //剔除多余输入
#define jackson printf("请输入答案")
char (*answer)[81],(*question1)[81], (*compar)[81];;
static char *question[]={"what the name of mine","who i like the most","when i"
"first do the\" 1+1\",it is"," yourself question"};
void input1(char *quetion[81]); //预设问题
int input2(); //问题个数
int judge1(int hh,int ss); //判断1,2,3,4
void choice(int funny,char (*question1)[81],char (*answer)[81]);
void output(int a,char (*question1)[81],char (*answer)[81]);
int main(void)
{
int x=0,a,num[3];
char ch;
printf("这是一个类似qq密码的程序.\n");
a=input2();
if(a=2) compar=question1=answer=(char (*)[81])malloc(2*81*sizeof(char));
else compar=question1=answer=(char (*)[81])malloc(3*81*sizeof(char));
input1(question);
srand((unsigned int)time(0));
printf("请选择第一个问题:(输入1,2,3,4):");
num[0]=judge1(0,0);
choice(num[0],question1,answer);
num[1]=judge1(num[0],0);
choice(num[1],question1,answer);
if(a==3)
{num[2]=judge1(num[0],num[1]);
choice(num[2],question1,answer); }
while(printf("你已经记住问题啦吗?(y或n):")&&getchar()!='y')
{michael;
Sleep(5000);
}
system("cls");
printf("警告:请不要有任何 动作\n");
for(int b=0;b<50;b++)
{
Sleep(1000);
if(b!=0&&!(b%10))
printf("还有%d秒",(50-b));
if(getchar())
{x=1;
break;}
}
if(x==0)
{printf("你好心耐心哦,一般很少有人这麽有耐心,呵呵");
getchar();
printf("天才即耐心."); }
if(x==1)
printf("哦,这麽急");
output(a,question1,answer);
return 0;
}
void input1(char *question[81])
{
printf("预设问题是:\n");
for(int a=0;a<4;a++)
printf("%d.%s\n",a+1,question[a]);
}
int input2()
{void input1(char *quetion[81]);
int a;
printf("你准备输入几个问题(2或3):");
while(!scanf("%d",&a)||(a!=2&&a!=3))
{michael;
printf("请输入2或3,呵呵:");}
return a;
}
int judge1(int hh,int ss) //判断输入1234的正确性
{
int a;
static int b=1;
if(b==1)
while(!scanf("%d",&a)||a<1||a>4)
{ michael;
printf("请输入数字1,2,3,4::");}
else if(b==2&&printf("请选择第二个问题:"))
while(!scanf("%d",&a)||a==hh||a<1||a>4)
{michael;
printf("请输入其他数字 :");}
else if(printf("请选择第三个问题:"))
while((!scanf("%d",&a)||a==hh||a==ss||a<1||a>4))
{michael;
printf("请输入其他数字");}
michael;
b++;
return a;
}
void choice(int funny,char (*question1)[81],char (*answer)[81]) //选择答案。
{
static int a=0;
printf("%s \n",question[funny-1]);
if(funny==4)
{printf("输入你的问题:");
gets(question1[a]);}
jackson;
gets(answer[a]);
a++;
}
void output(int a,char (*question1)[81],char (*answer)[81])
{
int b[3],f[3],c,e;
for(c=1,e=0;c<=a;c++)
{
b[0]=rand()%a;
printf("第1个 问题:%s",question1[b[0]]);
jackson;
gets(compar[b[0]]);
while((b[1]=rand()%a)==b[0]);
printf("第2个 问题:%s",question1[b[1]]);
jackson;
gets(compar[b[1]]);
if(a=3)
{
while((b[2]=rand()%a)==b[0]||b[2]==b[1]);
printf("第三个问题:%s",question1[b[2]]);
jackson;
gets(compar[b[2]]);
}
for(int d=0;d<a;d++)
{
if(strcmp(compar[b[d]],answer[b[d]]))
f[e]=d; e++;
}
if(e==0) break;
else
printf("请重新输入 ,你还有%d次机会\n" ,a-c);
}
}