下载此文档

华为笔试题-软件.doc


文档分类:IT计算机 | 页数:约8页 举报非法文档有奖
1/8
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/8 下载此文档
文档列表 文档介绍
华为笔试题- 软件华为的最近的 C 语言笔试题 2008-03-06 21:37 一、判断题(对的写 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 *********************************************************** 找错 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{ SRM_no %= MAX_SRM; if(==ID

华为笔试题-软件 来自淘豆网www.taodocs.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数8
  • 收藏数0 收藏
  • 顶次数0
  • 上传人xxj16588
  • 文件大小0 KB
  • 时间2016-03-29