c语言求改错#include typedef struct Birthday{short year;short mont
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/10/01 12:14:56
c语言求改错
#include
typedef struct Birthday
{
short year;
short month;
short day;
}Bir;
typedef struct Student
{
char name[10];
long ID;
Bir birthday;
float height;
float weight;
}STU;
STU MyClass[5];
void StudyStructMem()
{
printf("\tsize\tAddr0\tAddr1\tAddr2\tAddr3\tAddr4\tAddr5\n");
printf("Bithday:%d\t",sizeof(Bir));
printf("%x\t%x\t%x\t%x\n",&Bir,&Bir.year,&Bir.month,&Bir.day);
printf("Student:%d\t",sizeof(STU));
printf("%x\t%x\t%x\t%x\t%x\t%x\n",&STU,&STU.name,&STU.ID,&STU.Br,&STU.height,&STU.weight);
printf("MyClass:%d\t",sizeof(MyClass));
printf("%x\t%x\t%x\t%x\t%x\t%x\n",&MyClass,&MyClass[0],&MyClass[1],&MyClass[2],&MyClass[3],&MyClass[4]);
}
void main()
{
StudyStructMem();
}
C:\Users\IdeaPad\Desktop\Project8\eight1.c(27) :error C2275:'Bir' :illegal use of this type as an expression
C:\Users\IdeaPad\Desktop\Project8\eight1.c(9) :see declaration of 'Bir'
C:\Users\IdeaPad\Desktop\Project8\eight1.c(29) :error C2275:'STU' :illegal use of this type as an expression
C:\Users\IdeaPad\Desktop\Project8\eight1.c(18) :see declaration of 'STU'
#include
typedef struct Birthday
{
short year;
short month;
short day;
}Bir;
typedef struct Student
{
char name[10];
long ID;
Bir birthday;
float height;
float weight;
}STU;
STU MyClass[5];
void StudyStructMem()
{
printf("\tsize\tAddr0\tAddr1\tAddr2\tAddr3\tAddr4\tAddr5\n");
printf("Bithday:%d\t",sizeof(Bir));
printf("%x\t%x\t%x\t%x\n",&Bir,&Bir.year,&Bir.month,&Bir.day);
printf("Student:%d\t",sizeof(STU));
printf("%x\t%x\t%x\t%x\t%x\t%x\n",&STU,&STU.name,&STU.ID,&STU.Br,&STU.height,&STU.weight);
printf("MyClass:%d\t",sizeof(MyClass));
printf("%x\t%x\t%x\t%x\t%x\t%x\n",&MyClass,&MyClass[0],&MyClass[1],&MyClass[2],&MyClass[3],&MyClass[4]);
}
void main()
{
StudyStructMem();
}
C:\Users\IdeaPad\Desktop\Project8\eight1.c(27) :error C2275:'Bir' :illegal use of this type as an expression
C:\Users\IdeaPad\Desktop\Project8\eight1.c(9) :see declaration of 'Bir'
C:\Users\IdeaPad\Desktop\Project8\eight1.c(29) :error C2275:'STU' :illegal use of this type as an expression
C:\Users\IdeaPad\Desktop\Project8\eight1.c(18) :see declaration of 'STU'
#include <stdio.h>
typedef struct Birthday
{
short year;
short month;
short day;
}Bir;
typedef struct Student
{
char name[10];
long ID;
Bir birthday;
float height;
float weight;
}STU;
STU MyClass[5];
void StudyStructMem()
{
printf("\tsize\tAddr0\tAddr1\tAddr2\tAddr3\tAddr4\tAddr5\n");
printf("Bithday:%d\t",sizeof(Bir));
printf("%x\t%x\t%x\t%x\n", &Bir, &Bir.year, &Bir.month, &Bir.day);//Bir是类型 不能取地址
printf("Student:%d\t",sizeof(STU));
printf("%x\t%x\t%x\t%x\t%x\t%x\n", &STU, &STU.name, &STU.ID, &STU.Br, &STU.height, &STU.weight);//STU是类型 不能作为取地址 变量输出
printf("MyClass:%d\t",sizeof(MyClass));
printf("%x\t%x\t%x\t%x\t%x\t%x\n", &MyClass, &MyClass[0], &MyClass[1], &MyClass[2], &MyClass[3], &MyClass[4]);
}
typedef struct Birthday
{
short year;
short month;
short day;
}Bir;
typedef struct Student
{
char name[10];
long ID;
Bir birthday;
float height;
float weight;
}STU;
STU MyClass[5];
void StudyStructMem()
{
printf("\tsize\tAddr0\tAddr1\tAddr2\tAddr3\tAddr4\tAddr5\n");
printf("Bithday:%d\t",sizeof(Bir));
printf("%x\t%x\t%x\t%x\n", &Bir, &Bir.year, &Bir.month, &Bir.day);//Bir是类型 不能取地址
printf("Student:%d\t",sizeof(STU));
printf("%x\t%x\t%x\t%x\t%x\t%x\n", &STU, &STU.name, &STU.ID, &STU.Br, &STU.height, &STU.weight);//STU是类型 不能作为取地址 变量输出
printf("MyClass:%d\t",sizeof(MyClass));
printf("%x\t%x\t%x\t%x\t%x\t%x\n", &MyClass, &MyClass[0], &MyClass[1], &MyClass[2], &MyClass[3], &MyClass[4]);
}
c语言求改错#include typedef struct Birthday{short year;short mont
请问这个结构体所占的空间大小是___字节.typedef struct { int a,char b,short c,s
关于c语言,请问typedef struct {elemtype data ;struct Node *next ;}N
typedef struct
c 语言改错#include "stdio.h"void main(){int a,b,year,day,month;s
typedef struct在语言中代表的是什么?
short
typedef struct {...}*Pstr;
求补码怎么求的...#include #include void main (){unsigned short int
进制转换#include"stdio.h"#define Max 50typedef struct{ int elem[
C语言 中&和 请参照这个程序#include#define NULL 0struct student{int num;
He was short last year.(对short提问)