12-1
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define NAME_LEN 64
struct student
{
char name[NAME_LEN];
int height;
float weight;
long schols;
};
int main()
{
struct student takao = { "Takao",173,86.2 };
printf("%p %p %p %p", &takao.name, &takao.height, &takao.weight, &takao.schols);
return 0;
}
12-2
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define NAME_LEN 64
typedef struct student
{
char name[NAME_LEN];
int height;
float weight;
long schols;
}Student;
void hiroko(Student* std)
{
if (std->height < 180)
std->height = 180;
if (std->weight > 80)
std->weight = 80;
}
int main()
{
int height, schols;
double weight;
printf("身高:"); scanf("%d", &height);
printf("体重:"); scanf("%lf", &weight);
printf("奖学金:"); scanf("%d&#