腾讯 2021年程序员技术类面试题
小编:管理员 1413阅读 2021.06.19
局部变量能否和全局变量重名?
如何引用一个已经定义过的全局变量?
全局变量可不可以定义在可被多个.C文件包含的头文件中?为什么?
语句for( ;1 ;)有什么问题?它是什么意思?
do……while和while……do有什么区别?
请写出下列代码的输出内容
#include "stdio.h"
main()
{
int a,b,c,d;
a=10;
b=a++;
c=++a;
d=10*a++;
printf("b,c,d:%d,%d,%d",b,c,d);
return 0;
}
static全局变量与普通的全局变量有什么区别?static局部变量和普通局部变量有什么区别?static函数与普通函数有什么区别?
程序的局部变量存在于()中,全局变量存在于()中,动态申请数据存在于()中。
设有以下说明和定义:
typedef union {long i; int k[5]; char c;} DATE;
struct data { int cat; DATE cow; double dog;} too;
DATE max;
则语句 printf("%d",sizeof(struct date)+sizeof(max));的执行结果是:
队列和栈有什么区别?
写出下列代码的输出内容
#include "stdio.h"
int inc(int a)
{
return(++a);
}
int multi(int*a,int*b,int*c)
{
return(*c=*a**b);
}
typedef int(FUNC1)(int in);
typedef int(FUNC2) (int*,int*,int*);
void show(FUNC2 fun,int arg1, int*arg2)
{
INCp=&inc;
int temp =p(arg1);
fun(&temp,&arg1, arg2);
printf("%d\n",*arg2);
}
main()
{
int a;
show(multi,10,&a);
return 0;
}
请找出下面代码中的所有错误
说明:以下代码是把一个字符串倒序,如“abcd”倒序后变为“dcba”
#i nclude"string.h"
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;
}
相关推荐
- 2021年美团程序员面试题 第1题: k链表翻转。给出一个链表和一个数k,比如链表1→2→3→4→5→6,k=2,则翻转后2→1→4→3→6→5,若k=3,翻转后3→2→1→6→5→4,若k=4,翻转后4→3→2→1→5→6,用程序实现。 typedef struct node { struct node *next; int data;} node;void…
- 2021年腾讯面试题(技术岗) 第1题: 一、不定项选择题(共25题,每题4分,共100分,多选、少选、错选均不得分)1、 如果MyClass为一个类,执行”MyClass a[5], *b[6]”语言会自动调用该类构造函数的次数是()A. 2 B.5 C. 4 D.9第2题: 2、下面程序的运行结果是()#includeusing n…
- 经典笔试题-JDBC及Hibernate篇 五、JDBC 及Hibernate:(共12 题:基础10 道,中等难度2 道)110、数据库,比如100 用户同时来访,要采取什么技术解决?【基础】 答:可采用连接池。111、什么是ORM?【基础】 答:对象关系映射(Object—Relational Mapping,简称ORM)是一种为了解决面向对象…