面试要回顾的知识

1 计算机组成原理的那些通用寄存器等等

2c++ 的内存组织
面试要回顾的知识_第1张图片
3面试要回顾的知识_第2张图片

4面向过程设计(procedural programming )也称为:
1).功能分解(Function Decomposition)
2).自上而下逐步求精(top-down design, stepwise refinement)。
5面试要回顾的知识_第3张图片

6面试要回顾的知识_第4张图片

7 static_cast:Used to convert one data type to another and hands all reasonable casts
average = (float) hits / (float) at_bats;
average = static_cast(hits) / static_cast(at_bats);

const_cast:Used to cast away constness.
reinterpret_cast:
dynamic_cast:

8 enum { MIN_SIZE = 0,MAX_SIZE = 100 };
int minVal = MIN_SIZE;
int arr[MAX_SIZE];

9 c++的结构体可以包含函数
struct Point {
double x, y;
void setVal(double, double);
};
Point p;
p.x = 3.1415926;
p.y = 1.0;
p.setVal(4.11, -13.090);

10
Inline Function V.S. Macro
Similarities
Each occurrence is replacedwith the definition.
The overhead of a function call is avoided so that the program may execute more efficiently.
The size of the executable image can become quite largeif the expansions are large or there are many expansions.

Dissimilarities
A macro is expanded by the preprocessor, an inline function is expanded by the compiler.
Macro expansions do text substitution without regard to the semanticsof the code; but inline function expansions take into account the semantics.
Macro:No type-safety checking.
Macro:More than once parameter evaluation.
Inline functions are generally preferableto macros.

你可能感兴趣的:(编程语言,c语言,面试,设计,函数)