【C语言】关键字、操作符、控制语句

关键字

Keywords
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while

操作符

Operator(s) Operation(s) Order of evaluation
* 乘法 乘法、除法、余数优先执行。如果有多个同时存在则从左到右执行。
/ 除法
% 取余
+ 加法 加法、减法接着执行,如果有多个同时存在则从左到右开始执行。
- 减法
Assignment operator Sample expression Explanation
赋值运算符 案例 说明
+= num += 5 num = num + 5
-= num -= 5 num = num - 5
*= num *= 5 num = num *5
/= num /= 5 num = num / 5
%= num %= 5 num = num % 5
++ num++ 后置运算num = num + 1
++num 前置运算num = num + 1
-- num-- 后置运算num = num - 1
--num 前置运算num = num - 1

前置、后置递增运算案例

#include <stdio.h>

int main(int argc, char* argv[]) {
   
	int index = 5;

	printf("index = %d\n", index); 		// output index = 5
	printf("index++ = %d\n", index++);	// output index++ = 5
	printf("index = %d\n", index);		// output index = 6
	printf("++index = %d\n", ++index);	// output index = 7

	return 0;
}
Standard algebraic equality operator or relational operator C equality or relational operator Example of C condition Meaning of C condition
标准代数相等运算符或关系运算符 C相等或关系运算符 C条件示例 C条件含义
= = = == x == y x等于y
≠ \neq = != x != y x不等于y
> > > > x > y x大于y
< < < < x < y x小于y
≥ \geq >= x >= y x大于或等于y
≤ \leq <= x <= y x小于或等于y
logical operator Explanation
逻辑操作符 解释
&& AND与
|| OR或
! NOT非

1 条件判断语句

1.1 i f if if语句

Created with Raphaël 2.3.0 Start grade >= 60 print "Passed" End yes no
if (grade >= 60) {
   
	printf(
  • 26
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值