重庆某公司笔试题

采用的方式是视频面试然后每发出一道题让我做的,总体来说做的不怎么样,都挺简单的,就是有的题我可能真的没怎么注意,因为只刷了题,代码部分自己写的话还有点小困难,知道自己菜,对每一次面试机会都很珍惜,所以记录下来,仅供参考。
1. 写一个“标准"宏,这个宏输入两个参数并返回较大的一个。

 

2. int (p)[5]与int*p[5]有什么区别?

3. Main( )

{

Int a,b,c,d;

A = 6;

B=a++;

C=++a;

D=10*a++;

Printf(b,c,d:%d,%d,%d,b,c,d);

Return 0;

 

}

4. 有一个结构声明为struct data{};请写出使用typedef重定义一个指向struct data的类型

5. 设cpu为32位,有以下说明和定义:

#include <stdio.h>

int main(){

typedef union

{

    long i;

    int k[8];

    char c;

}DATE;

struct data

{

    int cat;

    DATE cow;

    double dog;

}too;

DATE max;

printf("%d",sizeof(struct data)+sizeof(max));

return 0;

}

 

6. 请找出下面代码中的所有错误,说明,一下代码是把一个字符串倒序,如“abcd”倒序后变为“dcba”

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

int main()

{

    char *src = "hello,world";

    char *dest = NULL;

    int len = strlen(src);

    dest = (char*)malloc(len);

    char* d = dest;

    char* s = src[len];

    while(len-- !=0)

    d++ = s--;

    printf("%s",dest);

    return 0;

}

7. 编写strcmp函数,已知strcmp函数的原型是int strcmp(const char*str1, const char*str2),str1与str2为需要比较的2个字符串。

8. 下面三个变量有什么区别?

char const *p;

char * const p;

const char *p;

9. 写出floatx与“零值”进行比较的if语句,判断×是否等于零。

10. Static

11. Volatile

12. string.h

 

 

 

#面试##笔试#
全部评论
是不方便透露哪家公司?那是什么岗位?
点赞 回复 分享
发布于 2022-07-26 21:03

相关推荐

06-04 17:59
已编辑
长江大学 Java
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
2
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务