C和C ++测验基础知识. [英] Basic of C and C++ quiz Questions.
本文介绍了C和C ++测验基础知识.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
main()
{
char *a = "a";
*a = ''r'';
printf(a);
}
1.输出是什么?
1. What is the output ?
main()
{
int a;
int *p;
a = 5;
p = &a
printf(a,p,*p);
}
2.输出是什么?
3.流动结构之间的区别
2. What is the output ?
3. Difference between the flowing structure
struct pack
{
unsigned int a:9;
} p;
struct pack
{
unsigned int a;
} p;
struct data
{
char name[80];
double age;
}
const data MyStruct = { "a", 1000 };
strcpy (MyStruct.name, "p");
printf(MyStruct.name);
4.输出?
4. Output ?
fib(n)
if(n = 0)
return 0
if(n = 1)
return 1
return fib(n -1) + fib(n - 2)
5.模拟fin(5)
5. Simulate fin(5)
推荐答案
通常是内存冲突错误:"a"是静态字符串,不应允许您更改它.
Normally a memory violation error: "a" is a static string, and you should not be allowed to change it.
它不会编译,所以没有输出.printf
不是内置函数,运算符或类型.
最可能的原因是缺少stdio.h.
那将是我在求职面试中的回答.
It won''t compile so there is no output.printf
is not a built in function, operator nor type.
Most likely cause is a missing include of stdio.h.
That would be my response in a job interview.
输出为:r
没有错误!是的.
Output is: r
There is no error! yeah.
这篇关于C和C ++测验基础知识.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文