笔试题循环

时间:2024-07-07 15:26:45 资料大全 我要投稿
  • 相关推荐

笔试题(循环)

三、简答题(25分)
1、头文件中的 ifndef/define/endif 干什么用?
2、#include %26lt;filename.h%26gt; 和
#include "filename.h" 有什么区别?
3、const 有什么用途?(请至少说明两种)
4、在C++ 程序中调用被 C编译器编译后的函数,
为什么要加 extern "C"声明?
5、请简述以下两个for循环的优缺点
// 第一个for (i=0; i%26lt;N; i++)
{if (condition)
DoSomething();
else
DoOtherthing();}
优点:缺点:
// 第二个if (condition)
{for (i=0; i%26lt;N; i++)
DoSomething();}
else{
for (i=0; i%26lt;N; i++) DoOtherthing();}
优点:缺点:
四、有关内存的思考题(20分)
void GetMemory(char *p)
{
p = (char *)malloc(100);
}
void Test(void)
{
char *str = NULL;GetMemory(str);
strcpy(str, "hello world");
printf(str);
}请问运行Test函数会有什么样的结果?答:
char *GetMemory(void)
{
char p[] = "hello world";
return p;
}
void Test(void)
{
char *str = NULL;
str = GetMemory();
printf(str);
}

【笔试题循环】相关文章:

360笔试题目06-27

笔美国国家仪器试题目09-23

搜狐产品笔归分享笔试题目07-05

团队游戏:循环相克令09-11

新浪笔经04-27

新闻总署笔经10-13

IBM公司笔经09-15

营销卷笔经10-25

consulting firm笔经05-06

科勒笔经09-23