问答题int id[sizeof(unsigned long)];这个对吗?为什么?

问答题
int id[sizeof(unsigned long)];这个对吗?为什么?

参考解析

解析: 暂无解析

相关考题:

下面是一个简单的使用RAWSOCKET实现的ping程序,填入(n)处。/*simple ping program*/struct sockaddr_in saddr;int rawsock;unsigned short in_cksum(unsigned short*addr, int len){ int sum=0;unsigned short res=0;while(1en>1){sum+=*addr++; len-=2;}if(len=1){*((unsigned char *)(res))=*((unsigned char *)addr); sum+=res;}sum=(sum>>16)+(sam 0xffff);sum+=(sum>>16); res=~sum;return res;}void ping(int signo){int len;int i;static unsigned short seq=0;char buff[8192];struct timeval tv;struet icmp*icmph=(struct icmp * )buff;long*data=(long*)icmph→icmp_data;bzero(buff, 8192);gettimeofday(tv, NULL);icmph→icmp_type=ICMP_ECHO;icmph→icmp_code=0;icmph→icmp_cksum=0;icmph→icmp_id=0;icmph→icmp_seq=0;icmph→icmp_id=getpid()0xffff;icmph→icmp_seq=seq++;data[0]=tv.tv_sec;data[1]=tv.tv_usec;for(i=8; i< ; i++)icmph→icmp_data[i]=(unsigned char)i;icmph→icmp_cksum=in_cksum((unsigned short *)buff, ? 72);len; sendto(rawsock, buff, 72, 0, saddr, sizeof(saddr));alarm(1);}void sigint(int signo){ printf("CATCH SIGINT !!! \n");close(rawsock);exit(0);}void dumppkt(char*buf, int len){ struct ip*iph=(struct ip*)buf;int i=iph→ip_h1*4;struct icmp*icmph=(struct icmp*)buf[i];long*data=(long*)iemph→icmp_data;struct timeval tv;gettimeofday(tv, NULL);if(icmph→icmp_type! =ICMP_ECHOREPLY)return;if(icmph→icmp_id! =(getpid()0xffff))return;printf("From %s:ttl=% d seq=% d time=%.2f ms\n",inet_ntoa(iph→ip_src),iph→ip_ttl?,icmph→icmp_seq,(tv.tv_see-data[0])*1000.0+(tv.tv_usec-data[0])/1000.0);}int main(int argc, char*argv[]){ int len;stuct timeval now;char recvbuff[8192];if(1){printf("%s aaa.bbb.ccc.ddd\n", argv[0]);exit(1);}rawsock=soeket(AF_INET, (2), IPPROTO_ICMP);if(rawsock<0) {perror("soeket");exit(1);}bzero ( saddr, sizeof(saddr));saddr.sin_family=(3);if( inet_aton( argv[1], saddr.sin_addr) <0) {printf("invalid IP address: %s\n", argv[1]);exit(1);}signal(SICALRM, ping);signal(SICINT, sigint);alarm(1);while (1){len=read (4), recvbuff, 8192);if( len<0 errno=EINTR)continue;else it( len<0)perror("read");else if( len>0)dumppkt(recvbuff, len);}close (5);exit(0);}

下列语句段中,正确的是( )。A.struct{int x;float y;int a[2];unsigned b[3];char name[10];};B.struct stu{unsigned a[3];unsigned b[4];}x;int*p=x.a;C.struct stu{int a;float x[4];}y={1,1.0};float data=y.x;D.struct nd{int a,b;unsigned c[2]=5;};

( 18 )下列各组类型声明符中,含义相同的一组是A ) unsigned long int 和 longB ) signed short int 和 shortC ) unsigned short 和 shortD ) short int 和 int

下列各组类型声明符中,含义相同的一组是A.unsigned long int和longB.signed short int和shortC.unsigned short和shortD.short int和int

以下选项中不属于c语言的类型的是( )。A.unsigned long intB.long shortC.unsigned intD.signed short int

下列程序的输出结果是( )。 #includestdio.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

阅读以下说明和C语言代码,回答问题1至问题5,将解答填入答题纸的对应栏内。[说明]在实模式存储管理方案下,嵌入式系统的内存地址空间的布局一般可以分为五个段:代码段(text)、数据段(data)、bss段(bss)、堆(heap)和栈(stack)。图16-4为一段例程。1: include2: unsigned char gvCh;3: unsigned short gvShort;4: unsigned int gvInt = 0x12345678;5: unsigned long gvLong = 0x87654321;6: void main(void)7: {8: unsigned char array[lO],*p;9: p = malloc(lO*sizeof(char));10: while (1);代码段、数据段和bss段的大小是在什么时候确定的?

下列程序的输出结果是()。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

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

设有以下说明和定义:typedef union {long i; int k[5]; char c;} DATE;struct data { int cat; DATE cow; double dog;} too;DATE max;则语句 printf("%d",sizeof(struct date)+sizeof(max));的执行结果是:___52____

若指针p已正确定义,要使p指向两个连续的整型动态存储单元,则正确语句是( )A.p=2 *(int *)malloc(sizeof(int));B.p=(int*)calloc(2*sizeof(int));C.p=(int*)malloc(2* sizeof(int));D.p=2 *(int*)calloc(sizeof(int));

设有以下说明和定义: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

阅读以下程序段,在实模式存储管理方案中,gvCh存放在(36)中;main函数编译后的代码存入在(37)中;指针p存放在(38)中。#include<malloc. h>unsigned char gvCh;unsigned short gvShortunsigned int gvInt=0x12345678unsigned long gvLong=0x23456789;ovid main(void){ unsigned char array[10], *p;p=malloc(10 * sizeof(char))while(1)}A..text段B..data段C..bss段D.堆空间

WIN32 平台下,sizeof(short) = ____,sizeof(int) = ____,sizeof(long) = ____。

switch(c) 语句中c可以是int, long, char, float, unsigned int 类型。( )

在表示C语言的整型变量时,表示“无符号整型”的符号是( )A.unsigned intB.unsigned shortC.long intD.unsigned long

有以下定义和语句,则sizeof(a.share)的值是( )。struct date{ unsigned int day;unsigned int mouth;unsigned int year;union{int share1;float share2;}share;}a;

设有以下说明和定义:typedef union{ long i;int k[5];char c; } DATE;struct date{ int cat;DATE cow;double dog; }too;DATE max;则下列语句的执行结果是______。printf("%d",sizeof (struct date) +sizeof(max));A.26B.30C.18D.8

下面程序的输出结果是_______。 union un { int a[4]; long b; char c[6];} main() { union un u; printf("%d%d",sizeof(u),sizeof(uA) ); }A.82B.88C.188D.182

若定义了以下函数; void sub(……) {…… *t=(int *)malloc(10*sizeof(int)); …… } 其中t是该函数的形参,要求通过t把动态分配存储单元的地址传回主调函数,则形参t的正确定义应该是( )A.int *tB.int **tC.long **tD.long *t

以下程序的输出结果是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

int id[sizeof(unsigned long)];这个对吗?为什么?

下选项中不属于C语言的类型是()。A、signed short intB、unsigned long intC、unsigned intD、long short

在C程序中,设一表达式中包含有int,long,char和unsigned类型的变量和数据,这四种类型数据的转换规则是()。A、int→unsigned→long→charB、char→int→long→unsignedC、char→int→unsigned→longD、int→char→unsigned→long

判断题数组的存储空间不一定在编译时进行分配。举个反例:int(*p)[6];p=(int(*)[6])malloc(sizeof(int[6])*1);*p是个int[6](而不是int*) ,sizeof(*p)是24而不是4 ,也就是说在堆上创建了一个int[6],但这个空间是在运行期分配的A对B错

单选题在C程序中,设一表达式中包含有int,long,char和unsigned类型的变量和数据,这四种类型数据的转换规则是()。Aint→unsigned→long→charBchar→int→long→unsignedCchar→int→unsigned→longDint→char→unsigned→long

问答题int id[sizeof(unsigned long)];这个对吗?为什么?