www.cnblogs.com/ruiyqinrui

开源、架构、Linux C/C++/python AI BI 运维开发自动化运维。 春风桃李花 秋雨梧桐叶。“力尽不知热 但惜夏日长”。夏不惜,秋不获。@ruiY--秦瑞

python爬虫,C编程,嵌入式开发.hadoop大数据,桉树,onenebula云计算架构.linux运维及驱动开发.

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1,逗号运算符

2,eg

2,条件运算符其实就是三目运算

条件表达式的一般格式:

【expression1?expression2:expression3】

3,sizeof用来计算一个变量或是一个常量,一种数据类型的内存字节数

 1 [root@node0 ruiy]# ./a.out
 2 常量内存字节:4
 3 未初始化int变量内存字节:4
 4 以初始化int变量内存字节数:4
 5 int数据类型内存字节数:4
 6 char数据类型内存字节数:1
 7 float数据类型内存字节数:4
 8 [root@node0 ruiy]# cat 6.c
 9 #include<stdio.h>
10 //Create by Qrui;
11 //
12 int main(int argc,const char *argv[],const char **env[]) {
13 
14         int size01 = sizeof(10);
15     int a;
16         int size02 = sizeof(a);
17     int b = 10;
18     int size03 = sizeof(b);
19     int size04 = sizeof(int);
20     int size05 = sizeof(char);
21     int size06 = sizeof(float);
22         //int size07 = sizeof(unsigned int);
23 
24     printf("常量内存字节:%d\n",size01);
25         printf("未初始化int变量内存字节:%d\n",size02);
26         printf("以初始化int变量内存字节数:%d\n",size03);
27         printf("int数据类型内存字节数:%d\n",size04);
28         printf("char数据类型内存字节数:%d\n",size05);
29         printf("float数据类型内存字节数:%d\n",size06);
30         return 0;
31 }

自增自减运算符

a++ ++a =>a = a+1

a-- --a => a = a-1;

4,逻辑运算符

&& || !

 1 【root@Qrui ruiy】#
 2 
 3 #include<stdio.h>
 4 int main(int argc,const char *argv[],const char **env[]) {
 5     int a = -1;
 6     int b = 11;
 7     int c d e;
 8     c = (a>0 && b>0);
 9     d = (a>0 || b>0);
10     e = (a>0 ! b>0);
11     printf("%d\n",c);
12     printf("%d\n",d);
13     printf("%d\n",e);
14     return 0;
15 }

别的像算术运算和关系运算就不说了,

但要注意= 和==;

posted on 2013-08-12 17:37  秦瑞It行程实录  阅读(324)  评论(0编辑  收藏  举报
www.cnblogs.com/ruiyqinrui