博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux c 笔记-3 c语言基础知识
阅读量:4560 次
发布时间:2019-06-08

本文共 1183 字,大约阅读时间需要 3 分钟。

关键字

数据类型:

  简单(7):int long short float double char enum

  复杂(2):struct union

  类型修饰符(8):auto unsigned signed extern register static volatile void

  定义(2): typedef const

  其他(1): sizeof

   

      数据类型示意图:

    

  

流程控制:

  条件跳转(5):

    if else

    switch case default
  循环(5):
    do while
    for
    continue
    break

  无条件跳转(2):

    goto
    return

运算符

  加减乘除:+          -           *            /

  模: %

  移位: >>             <<

      比较: >            <            =         != 

  自增/减: ++  --

 

数据类型详解

  整型: short  int long (char)

     32bit机器上

类型 字节 值范围
char -128 ~ 127(有符) 或 0 ~ 255 (无符)
unsigned char 0 ~ 255
signed char -128 ~ 127
int 2 或 4  -3 2768 ~ 3 2767 或 -21 4748 3648 ~ 21 4748 3647
unsigned int 2 或 4  0 ~ 6 5535 或 0 ~ 42 9496 7295
short -3 2768 ~ 3 2767
unsigned short 0 ~ 6 5535
long -21 4748 3648 to 21 4748 3647
unsigned long 0 ~ 42 9496 7295

  

    int占用的具体字节数,不同机器环境不同,具体用sizeof查看:

#include
void main(){ printf("sizeof inf:%d\n", sizeof(int));}

    浮点型:

类型 字节 范围 精度
float 1.2E-38 ~ 3.4E+38 6 decimal places
double 2.3E-308 ~ 1.7E+308 15 decimal places
long double 10  3.4E-4932 ~ 1.1E+4932 19 decimal places

  

 

参考:http://www.tutorialspoint.com/cprogramming/c_quick_guide.htm

转载于:https://www.cnblogs.com/Tommy-Yu/p/5818717.html

你可能感兴趣的文章
php手册总结《安装与配置》
查看>>
PAT-乙级-1001. 害死人不偿命的(3n+1)猜想 (15)
查看>>
git安装及使用
查看>>
mysql一个非常实用解决sql查询优化的函数explain
查看>>
图文讲解NTFS和FAT32硬盘下 asp.net 生成word 错误: 80070005 和 错误:8000401a 的解决方法...
查看>>
《学习》5连接查询(高级查询)
查看>>
python日常—爬取豆瓣250条电影记录
查看>>
11.3NOIP模拟赛
查看>>
1.SDL介绍
查看>>
【重要更新】语言转换类编程工具Tangible系列本月又更新了!
查看>>
现场赛:开关灯问题
查看>>
codeforces A. Jeff and Rounding (数学公式+贪心)
查看>>
zoj 3462
查看>>
java多线程-信号量
查看>>
如何在Delphi XE2中使用Dynamic Web TWAIN
查看>>
js自定义实用函数总结
查看>>
java内存区域与内存溢出异常
查看>>
点点滴滴的成长[2011-11-1]:理解C#修饰符
查看>>
csrf(跨站请求伪造)
查看>>
高性能MySQL笔记-第1章MySQL Architecture and History-001
查看>>