5.2作业

1.

data  || 1(<<7)

data && ~(1<<7)

data ^  (1<<7)

2.

(1)5

(2)6,5,5

d=5,循环执行5此,就是5个char类型,strlen=5

3.

tmpInfo1.height=1;

tmpInfo1.baseInfo.with=2

tmpInfo2.height=1

tmpInfo2->baseInfo.with=2

tmpInfo3->height=1

4.9

5.

(1)int *p=(int *)0x80000000;

*p=tmp;

tmp=*p;

(2)    char *q=(char*)&tmp;

        for(i=0;i<4;i++)

        buf[4+i]=q[i];

(3)

char*buf[count]===>char *buf=(char*)malloc(count*sizeof(char))

6.

(1)seqn[tail]=data;

tail++;

(2)data=seqn[head];

head++;

(3)if(head==tail)

(4)if((tail-head)==SEQLEN)

(5)head=tail;

tail++;

(6)tail-head;

(7)SEQLEN

7.(1)Rdy[i] || (1<<i)

(2)Rdy[j] && ~(1<<j)

(3)

for(int i=0;i<8;i++)

{ 
    for(int j=0;j<8;j++)

    {
        if(Rdy[i]=0x01<<j)
        {

            printf("Rdy[%d]  %d",i,j);

            return ;
        }
    }
}

8.可能出现i>=100,数组不包含此下标,*value=0没有意义。加0<=i<100,将*value=0移至赋值语句前

9.int型为参数,调用了参数为int型变量的函数。

10.(1)str指针指向NULL,空指针申请了10字节内存空间,对12字节空间进行赋值。

(2)第三行:p=(char*)malloc(32);

void Test(void)

{
        char a[32]="hello world";

        char *str;

        GetMemory(str);

        strcpy(str,a);

        printf(str);

        free(str);

        str=NULL;

}  

  • 8
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

心若向阳,何惧悲伤

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值