Impossible is nothing  
  爱过知情重醉过知酒浓   花开花谢终是空   缘份不停留像春风来又走   女人如花花似梦
公告
日历
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011
统计
  • 随笔 - 8
  • 文章 - 91
  • 评论 - 16
  • 引用 - 0

导航

常用链接

留言簿(4)

随笔分类(4)

随笔档案(8)

文章分类(77)

文章档案(91)

相册

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 

2005 年华为招聘 -- C 语言笔试试题

 

一、 判断题(对的写 T ,错的写 F 并说明原因,每小题 4 分,共 20 分)

1 、有数组定义 int a[2][2]={{1},{2,3}}; a[0][1] 的值为 0 。(     

2 int (*ptr) (), ptr 是一维数组的名字。(     

3 、指针在任何情况下都可进行 >,<,>=,<=,== 运算。(     

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

5 #define print(x)  printf( the no, #x ,is )

 

二、填空题(共 30 分)

1 、在 windows 下,写出运行结果,每空 2 分,共 10 分。

char str[ ]= Hello ;

char *p=str;

int n=10;

sizeof(str)=(      )

sizeof(p)=(       )

sizeof(n)=(       )

 

void func(char str[100])

{    }

sizeof(str)=(     )

 

2 void setmemory(char **p, int num)

{ *p=(char *) malloc(num);}

void test(void)

{  char *str=NULL;

   getmemory(&str,100);

   strcpy(str, hello );

   printf(str);

}

运行 test 函数有什么结果?(                                 10

 

3 、设 int arr[]={6,7,8,9,10};

     int *ptr=arr;

   *(ptr++)+=123;

 printf( %d,%d ,*ptr,*(++ptr));

(                                   ) 10

 

二、 编程题(第一小题 20 ,第二小题 30 分)

1   不使用库函数,编写函数 int strcmp(char  *source, char *dest)

  相等返回 0 ,不等返回 -1

 

2   写一函数 int fun(char *p) 判断一字符串是否为回文,是返回 1 ,不是返回 0 ,出错返回 -1
posted on 2006-03-23 23:29 笑笑生 阅读(372) 评论(0)  编辑 收藏 引用 所属分类: C++语言

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


 
Copyright © 笑笑生 Powered by: 博客园 模板提供:沪江博客