网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

struct w

{ char low;

char high;

};

union u

{ struct w byte;

short word;

}uw;

main( )

{ int result;

uw.word=0x1234;

printf(“word value:%04x\n”,uw.word);

printf(“high byte:%02x\n”,uw.byte.high);

printf(“low byte:%02x\n”,uw.byte.low);

uw.byte.low=0x74;

printf(“word value:%04x\n”,uw.word);

result=uw.word+0x2a34;

printf(“the result:%04x\n”,result);

}


参考答案

更多 “ struct w{ char low;char high;};union u{ struct w byte;short word;}uw;main( ){ int result;uw.word=0x1234;printf(“word value:%04x\n”,uw.word);printf(“high byte:%02x\n”,uw.byte.high);printf(“low byte:%02x\n”,uw.byte.low);uw.byte.low=0x74;printf(“word value:%04x\n”,uw.word);result=uw.word+0x2a34;printf(“the result:%04x\n”,result);} ” 相关考题
考题 ( 38 )有以下定义和语句struct workers{ int num;char name[20];char c;struct{ int day; int month; int year; } s;} ;struct workers w,*pw;pw = w;能给 w 中 year 成员赋 1980 的语句是A ) *pw.year = 198O;B ) w.year=1980;C ) pw-year=1980;D ) w.s.year=1980;

考题 若有以下说明和定义语句,则变量w在内存中所占的字节数是 【19】 。union aa {float x; float y; char c[6]; };struct st{ union aa v; float w[5]; double ave; } w;

考题 若有下面说明和定义:struct test{ int m1;char m2;float m3;union uu(char u1[5];int u2[2];)ua;}myaa; 则sizeof(struct test)的值是( )。A)20 B)16C)14 D)9

考题 下列程序的输出结果是( )。 #include "stdio.h" main() { struct st { int y,x,z;}; union {long i;int j; char k;} un; printf("%d,%d\n",sizeo(struct st),sizeof(un)); }A.6,2B.6,4C.8,4D.8,6

考题 ● 给定 C 语言的数据结构struct T {int w;union T { char c; int i; double d; } U;};假设 char 类型变量的存储区大小是 1 字节,int 类型变量的存储区大小是 4 字节,double类型变量的存储区大小是 8 字节,则在不考虑字对齐方式的情况下,为存储一个 struct T类型变量所需要的存储区域至少应为 (15) 字节。(15)A. 4B. 8C. 12D. 17

考题 阅读以下函数说明和C语言函数,将应填入(n)处的字句写在对应栏内。[说明]本程序实现对指定文件内的单词进行计数。其中使用二叉树结构来保存已经读入的不同单词,并对相同单词出现的次数进行计数。此二叉树的左孩子结点的字符串值小于父结点的字符串值,右孩子结点的字符串值大于父结点的字符串值。函数getword(char*filename,char*word)是从指定的文件中得到单词。char*strdup(char*S)是复制S所指向的字符串,并返回复制字符串的地址。[C程序]include <stdio.h>include <ctype.h>include <string.h>define MAXWORD 100struct node {char*word;int count;struct node*left;struct node*right;}struct node*addtree(struct node*P,char*w){ int cond;if(p==NULL){ /*向树中插入结点*/P=(struct node*)malloc(sizeof(struct node));P->word=strdup(w);P->count=1;(1) ;}elseif((oond=strcmp(w,p->word))==0) (2) ;else if(cond<0)p->left=(3);else p->right=(4);return p;}main(){ Struct node*root;char word[MAXWORD];root=NULL;filename="example.dat";while(getword(filename,word)!=EOF))root=(5);}

考题 若有下面的说明和定义struct test{ int ml; char m2; float m3;union uu {char ul[5]; int u2[2];} ua;} myaa;则sizeof(struct test )的值是A.12B.16C.14D.9

考题 C数组名称是指针变量吗? 看这段程序,可是执行。#include stdio.hint main(int argc, char *argv[]){ struct info { char name[33]; int age; }; struct info aa[3]={"meng",20,"juan",29,"an",59}; struct info *p=aa; for(int i=0;i3;i++,p++) printf("%-6s %d\n",p-name,p-age);}将其改成这样:#include stdio.hint main(int argc, char *argv[]){ struct info { char name[33]; int age; }; struct info aa[3]={"meng",20,"juan",29,"an",59}; //struct info *p=aa; for(int i=0;i3;i++,aa++) printf("%-6s %d\n",aa-name,aa-age);}为什么就执行不了呢

考题 下列对结构及其变量定义错误的是( )。A.struct My StructB.struct MyStruct{ {int num; int num;char ch; char ch;} }My;C.strutD.struct{ {int num; int num;char ch; char ch;}My; };

考题 变量a所占内存字节数是______。 union U { char st[4]; int i; long 1; }; struct A { int c; union U u; }a;A.4B.5C.6D.8

考题 下列程序的输出结果是()。includemain(){struct st{int y,x,z;};union{long i; int j; 下列程序的输出结果是( )。 #include<stdio.h> main() { struct st { int y,x,z; }; union { long i; int j; char k; }un; printf("%d,%d\n",sizeof(struct st),sizeof(un)); }A.6,2B.6,4C.8,4D.8,6

考题 有以下定义和语句: struct students {int num;char name[20];char c; struct {int grade1;int grade2;}s; }; struct students w,*pw; *pw=w; 下列赋值语句不正确的是( )。A.w.num=1002;B.w.grade1=85;C.pw->num=1002;D.w.s.grade2=85;

考题 若有如下说明和定义struct test{ int ml; char m2; float m3; union uu {char ul[5]; int u2[2];} ua;} myaa;则sizeof(struct test)的值是A.12 B.16 C.14 D.9

考题 下列程序的输出结果是( )。 include main() { struct st { int y,x,z; }; union {long 下列程序的输出结果是( )。 #include <stdio.h> main() { struct st { int y,x,z; }; union { long i; int j; char k; } un; printf("%d,%d\n",sizeof(struct st),sizeof(un)); }A.6, 2B.6, 4C.8, 4D.8, 6

考题 以下程序的输出结果是【】。 include main() {struct stru {int a; float b; char d[4]; } 以下程序的输出结果是【 】。include<stdio.h>main(){ struct stru{ int a;float b;char d[4];};printf("%d\n",sizeof(struct stru));}

考题 设有以下说明和定义:includeVoid main() {typedef union{long i; int k[5]; char 设有以下说明和定义:#include<iostream. h>Void main() {typedef union{long i; int k[5]; char c;}DATE;struct date{iNt cat; DATE cow; double. dog;}too;DATE max;则下列语句的执行结果是( )。cout<<(sizeof(struct date)+sizeof(max))<<end1;}A.26B.52C.18D.8

考题 变量a所占的内存字节数是 ______。A.4B.5C.6D.8 union U { char st[4]; int i; long l; }; Struct A{ int c; union U u; }a;

考题 有如下程序段#include "stdio.h"typedef union{ long x[2]; int y[4]; char z[8];}atx;typedef struct aa { long x[2]; int y[4]; char z[8];} stx;main(){ printf("union=%d,struct aa=%d\n",sizeof(atx),sizeof(stx));}则程序执行后输出的结果是A.union=8,struct aa=8 B.union=8,struct aa=24C.union=24,struct aa=8 D.union=24,struct aa=24

考题 设有以下说明和定义:includeVoid main() {typedef union{long i; int k[5]; char 设有以下说明和定义: #include<iostream. h> Void main() { typedef union { long i; int k[5]; char c; } DATE; struct date {int cat; DATE cow; double dog; }too; DATE max; cout<<(sizeof(struct date)+sizeof(max))<<end1;}A.26B.52C.18D.8

考题 若有下面的说明和定义: struct test { int m1; char m2; float m3; union uu {char u1[5]; int u2[2];}ua; }myaa; 则sizeof(stmct test)的值是( )。A.12B.16C.14D.9

考题 自动类型转换规定的优先次序是( )。A.short,byte,char→long→int→float→doubleB.short,byte,char→int→long―float→doubleC.byte,short,char→long→int→float→doubleD.byte,short,char→int→long→float→double

考题 以下程序的输出结果是includemain(){ union un{ int i;long k;char c;};struct byte{i 以下程序的输出结果是 #include<stdio.h> main() { union un{ int i; long k; char c;}; struct byte{ int a; long b; union un c;}r; printf("%d\n",sizeof(r));}A.10B.13C.7D.8

考题 以下程序的输出结果是() includemain(){ union un{int i; long k; char c;};struct by 以下程序的输出结果是( ) # include<stdio.h> main() { union un{int i; long k; char c; }; struct byte{ int a; long b; union un c; } r; printf("%d\n",sizeof(r)); }A.10B.13C.7D.8

考题 下列对结构及其变量定义错误的是( )。A.struct My Struct { int num; char ch; }B.struct MyStruct { int num; char ch; }My;C.strut { int num; char ch; }My;D.struct { int num; char ch; };

考题 若有下面的说明和定义: struct test { int m1; char m2; float m3; union uu {char ul[5]; int u2[2];} ua; }myaa;则sizeof(struct test)的值是( )。A.12B.16C.14D.9

考题 有以下说明语句:struct Worker{int no;char name[20];};Worker w,*p=w;则下列错误的引用是()A、w.noB、p-noC、(*p).noD、*p.no

考题 单选题有以下说明语句:struct Worker{int no;char name[20];};Worker w,*p=w;则下列错误的引用是()A w.noB p-noC (*p).noD *p.no