![]() |
#2
hys19862011-05-22 23:46
|

# include <stdio.h>
# include <string.h>
struct student
{
int age;
char sex;
char name;
};
void input(struct student *);
void output(struct student *);
int main(void)
{
struct student st;
input(&st);
output(&st);
return 0;
}
void input(struct student *pst)
{
(*pst).age = 10;
错误在这--> strcpy(pst->name, "王二");
pst->sex = '男';
return ;
}
void output(struct student *pstu)
{
printf ("%d%c%c",pstu->age,pstu->name,pstu->sex);
return ;
}
error C2664: 'strcpy' : cannot convert parameter 1 from 'char' to 'char *' # include <string.h>
struct student
{
int age;
char sex;
char name;
};
void input(struct student *);
void output(struct student *);
int main(void)
{
struct student st;
input(&st);
output(&st);
return 0;
}
void input(struct student *pst)
{
(*pst).age = 10;
错误在这--> strcpy(pst->name, "王二");
pst->sex = '男';
return ;
}
void output(struct student *pstu)
{
printf ("%d%c%c",pstu->age,pstu->name,pstu->sex);
return ;
}