华为的笔试题(2004-7-24 from smth)

.    找错
Void test1()
{
    char string[10];
    char* str1=”0123456789”;
strcpy(string, str1);
}


Void test2()
{
    char string[10], str1[10];
for(I=0; I<10;I++)
{
        str1[i] =’a’;
}
strcpy(string, str1);
}

Void test3(char* str1)
{
    char string[10];
    if(strlen(str1)<=10)
{
    strcpy(string, str1);
}
}


2.    找错
#define MAX_SRM 256

DSN get_SRM_no()
{
        static int SRM_no;
        int I;
        for(I=0;I<MAX_SRM;I++,SRM_no++)
{
SRM_no %= MAX_SRM;
if(MY_SRM.state==IDLE)
{
    break;
}
}
if(I>=MAX_SRM)
return (NULL_SRM);
else
return SRM_no;
}


3.    写出程序运行结果

int sum(int a)
{
        auto int c=0;
        static int b=3;
c+=1;
b+=2;
return(a+b+C);
}
    
void main()
{
        int I;
int a=2;
for(I=0;I<5;I++)
{
    printf(“%d,”, sum(a));
}
}

4.    

int func(int a)
{
    int b;
    switch(a)
    {
        case 1: 30;
        case 2: 20;
        case 3: 16;
        default: 0
}
return b;
}
则func(1)=?

5:
int a[3];
a[0]=0; a[1]=1; a[2]=2;
int *p, *q;
p=a;
q=&a[2];
则a[q-p]=?

6. 
定义 int **a[3][4], 则变量占有的内存空间为:_____

7.
编写一个函数,要求输入年月日时分秒,输出该年月日时分秒的下一秒。如输入2004年12月31日23时59分59秒,则输出2005年1月1日0时0分0秒。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值