腾讯 2021年程序员技术类面试题

小编:管理员 1413阅读 2021.06.19

第1题:


局部变量能否和全局变量重名?


第2题:


如何引用一个已经定义过的全局变量?


第3题:


全局变量可不可以定义在可被多个.C文件包含的头文件中?为什么?


第4题:


语句for( ;1 ;)有什么问题?它是什么意思?


第5题:


do……while和while……do有什么区别?


第6题:


请写出下列代码的输出内容

#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;

}



第7题:


static全局变量与普通的全局变量有什么区别?static局部变量和普通局部变量有什么区别?static函数与普通函数有什么区别?


第8题:


程序的局部变量存在于()中,全局变量存在于()中,动态申请数据存在于()中。


第9题:


设有以下说明和定义:

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));的执行结果是:



第10题:


队列和栈有什么区别?


第11题:


写出下列代码的输出内容

#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;

}



第12题:


请找出下面代码中的所有错误

说明:以下代码是把一个字符串倒序,如“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;

}



关联标签: