290
若有以下程序
#include
typedef struct stu {
char name[10], gender;
int score;
} STU;
void f(STU a, STUB)
{ b = a;
printf( "%s,%c,%d,", b.name, b.gender, b.score );
}
main()
{ STU a={"Zhao", 'm', 290}, b={"Qian", 'f', 350};
f(a,b);
printf("%s,%c,%d\n", b.name, b.gender, b.score);
}
则程序的输出结果是
有以下程序
#include
typedef struct stu {
char name[10];
char gender;
int score;
} STU;
void f(STU *a, STU *b)
{ b = a;
printf("%s,%c,%d,", b->name, b->gender, b->score);
}
main()
{ STU a={"Zhao", 'm', 290}, b={"Qian", 'f', 350};
f(&a,&b);
printf("%s,%c,%d\n", b.name, b.gender, b.score);
}
程序的运行结果是
有以下程序
#include
#include
typedef struct stu {
char name[10];
char gender;
int score;
} STU;
void f(STU c)
{ strcpy(c.name, "Qian");
c.gender = 'f';
c.score = 350;
}
main()
{ STU a={"Zhao", 'm', 290}, b;
b=a;
f(b);
printf("%s,%c,%d,", a.name, a.gender, a.score);
printf("%s,%c,%d\n", b.name, b.gender, b.score);
}
程序的运行结果是
有以下程序
#include
typedef struct stu {
char name[10];
char gender;
int score;
} STU;
void f(STU *a, STU *b)
{ *b = *a;
printf("%s,%c,%d,", b->name, b->gender, b->score);
}
main()
{ STU a={"Zhao", 'm', 290}, b={"Qian", 'f', 350};
f(&a,&b);
printf("%s,%c,%d\n", b.name, b.gender, b.score);
}
程序的运行结果是
有以下程序
#include
#include
typedef struct stu {
char name[10];
char gender;
int score;
} STU;
void f(char *name, char gender, int score)
{ strcpy(name, "Qian");
gender = 'f';
score = 350;
}
main()
{ STU a={"Zhao", 'm', 290}, b;
b=a;
f(b.name,b.gender,b.score);
printf("%s,%c,%d,", a.name, a.gender, a.score);
printf("%s,%c,%d\n", b.name, b.gender, b.score);
}
程序的运行结果是