怀化网站建设有哪些,免费网站下载app软件免费,微信推广平台,汕头网站上排名作业要求#xff1a; 复习课上内容 //已完成结构体字节对齐#xff0c;64位没做完的做完#xff0c;32位重新都做一遍#xff0c;课上指定2字节对齐的做一遍#xff0c;自己验证 //已完成两种验证大小端对齐的代码写一遍复习指针内容 //已完成完善顺序表已写出的… 作业要求 复习课上内容 //已完成结构体字节对齐64位没做完的做完32位重新都做一遍课上指定2字节对齐的做一遍自己验证 //已完成两种验证大小端对齐的代码写一遍复习指针内容 //已完成完善顺序表已写出的功能 3.
1共用体
运行代码:
#includestdio.h
#includestring.h
#includestdlib.h
union A
{int a;char c;
}A; int main(int argc, const char *argv[])
{A a1;a1.a0x12345678;if(a1.c0x78){pirntf(小端\n);}else{printf(大端\n);}return 0;
}
2memset函数
运行代码
#includestdio.h
#includestring.h
#includestdlib.h
int main(int argc, const char *argv[])
{int a0x12345678;memset(a,0x11, 1);char *pa;if(*p0x11){printf(小端\n);}else {printf(大端\n);}return 0;
}运行截图 5.
运行代码
#include list.h
int main(int argc, const char *argv[])
{seq_p p1creat_seq_list();if(seq_empty(p1)1){printf(空\n);}else if(seq_full(p1)1){printf(满\n);}p1NULL;free(p1);return 0;
} #include list.hseq_p creat_seq_list()
{seq_p L(seq_p)malloc(sizeof(seq_list));if(LNULL){return -1;}bzero(L,sizeof(L-data));printf(%d\n,L-len);return L;
}int seq_full(seq_p L)
{if(LNULL){return -1;}return L-lenMAX?1:0;
}
int seq_empty(seq_p L)
{if(LNULL){return -1;}return L-len0?1:0;
}#ifndef __LIST_H__
#define __LIST_H__
#includestdio.h
#includestdlib.h
#includestrings.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 运行截图