免费的课程设计哪个网站有,wordpress小夜,贵阳手机银行app,网店代运营商复习课上内容#xff08;已完成#xff09;结构体字节对齐#xff0c;64位没做完的做完#xff0c;32位重新都做一遍#xff0c;课上指定2字节对齐的做一遍#xff0c;自己验证#xff08;已完成#xff09;两种验证大小端对齐的代码写一遍复习指针内容#xff08;已完…复习课上内容已完成结构体字节对齐64位没做完的做完32位重新都做一遍课上指定2字节对齐的做一遍自己验证已完成两种验证大小端对齐的代码写一遍复习指针内容已完成完善顺序表已写出的功能
3.两种验证大小端对齐的代码写一遍
//验证大小端存储
#include stdio.h
#include string.h
int main(int argc, const char *argv[])
{int a 0x12345678;char *p a;if(*p 0x78){printf(小端存储\n);}else{printf(大端存储\n);}return 0;
} #include stdio.h
#include string.h
union A
{char t1;int t2;
};
int main(int argc, const char *argv[])
{union A a1;a1.t2 0x12345678;if(a1.t10x78){printf(小端\n);}else{printf(大端\n);}return 0;
} 5.完善顺序表已写出的功能
seq.list.h文件
#ifndef __SEQ_LIST_H__
#define __SEQ_LIST_H__
#include stdio.h
#include stdlib.h
#include strings.h
#define MAX 7
typedef int datatype;
typedef struct seq_list
{datatype data[MAX];int len;
}seq_list,*seq_p;seq_p creat_seq_list();
int seq_empty(seq_p L);
int seq_full(seq_p L);#endif
seq.list.c文件
#include seq_list.h
seq_p creat_seq_list()
{seq_p L (seq_p)malloc(sizeof(seq_list));if(LNULL){printf(申请空间失效\n);return NULL;}L-len 0;//长度置0bzero(L,sizeof(L-data));return L;
}//判空
int seq_empty(seq_p L)
{if(LNULL){return -1;}return L-len0?1:0;
}//判满
int seq_full(seq_p L)
{if(LNULL){return -1;}return L-lenMAX?1:0;
}
main.c 文件
#include seq_list.h
int main(int argc, const char *argv[])
{seq_p L creat_seq_list();printf(%d\n,seq_empty(L));printf(%d\n,seq_full(L));return 0;
}