游戏开发工程师--C基础

225 阅读3分钟

C语言运算符优先级

优先级 运算符 名称或含义 使用形式 结合方向 说明
1 () 调节优先级的括号操作符 5 从左到右 5
[] 数组下标访问操作符 5 从左到右 5
. 成员选择(对象) 5 从左到右 5
-> 成员选择(指针) 5 从左到右 5
2 - 负号运算符 5 从右到左 5
按位取反运算符 5 从右到左 5
++ 自增运算符 5 从右到左 5
-- 自减运算符 5 从右到左 5
* 取值运算符 5 从右到左 5
& 取地址运算符 5 从右到左 5
! 逻辑非运算符 5 从右到左 5
(type) 强制类型转换 5 从右到左 5
sizeof 长度运算符 5 从右到左 5
3 / 5 从左到右 5
* 5 从左到右 5
% 余数(取模) 5 从左到右 5
4 + 5 从左到右 5
- 5 从左到右 5
5 << 左移 5 从左到右 5
>> 右移 5 从左到右 5
6 > 大于 5 从左到右 5
< 大于等于 5 从左到右 5
>= 小于 5 从左到右 5
<= 小于等于 5 从左到右 5
7 == 等于 5 从左到右 5
!= 不等于 5 从左到右 5
8 & 按位与 5 从左到右 5
9 ^ 按位异或 5 从左到右 5
10 | 按位或 5 从左到右 5
11 && 逻辑与 5 从左到右 5
12 | | 逻辑或 5 从左到右 5
13 ?: 条件运算符 5 从左到右 5
14 = 赋值运算符 5 从左到右 5
/= 除后赋值 5 从左到右 5
*= 乘后赋值 5 从左到右 5
%= 取模后赋值 5 从左到右 5
+= 加后赋值 5 从左到右 5
-= 减后赋值 5 从左到右 5
<<= 左移后赋值 5 从左到右 5
>>= 右移后赋值 5 从左到右 5
&= 按位与后赋值 5 从左到右 5
^= 按位异或后赋值 5 从左到右 5
|= 按位或后赋值 5 从左到右 5
15 , 5 从左到右 5

说明:

同一优先级的运算符,运算次序由结合方向所决定。     简单记就是:! > 算术运算符 > 关系运算符 > && > || > 赋值运算符

数据类型

序列 类型与描述
1 1 基本类型:它们是算术类型,包括两种类型:整数类型和浮点类型。
2 2 构造类型:它们包括:数组类型、结构类型、共用体类型、枚举类型和函数类型
3 3 指针类型
4 4 void 类型:类型说明符 void 表明没有可用的值。

表达式

计算

判断

循环控制

函数

数组

指针

字符串

结构类型

程序结构

ACLLib的基本图形函数

链表

交互图形设计

文件

When the OS runs your compiled C++ program, the first line of main() isn't the very first instruction that gets executed.

There is a certain amount of work that needs to be done between the OS handing over control to your program, and it being ready to execute your code.

Some examples are

  • getting the command line from the OS, and arranging it so it looks like an argc,argv[] that can be passed to your main()
  • calling the constructors for any global objects (cin,cout,cerr are good examples).
  • preparing for exceptions
  • preparing for threads

All that pre-work is collectively your crtexe.c

Is it specific to the Visual Studio? Well it's specific to any particular compiler. But in general, most hosted environments are going to have something similar in concept, even if not identical in name and function.