zoukankan      html  css  js  c++  java
  • linux c 笔记-3 c语言基础知识

    关键字

    数据类型:
      简单(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<stdio.h>
    void main()
    {
            printf("sizeof inf:%d
    ", 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

  • 相关阅读:
    (二)vue的生命周期及相关的运行流程
    Vue接入百度地图显示及相关操作
    前端开发环境的介绍
    更改博客园的样式
    Ant Design of Vue 组件库的使用
    Vue 更换页面图标和title
    (四) Vue 相关的路由配置(及子路由配置)
    SVN创建分支的相关操作
    vs code插件自动压缩 min.css
    敲开通往架构师的门
  • 原文地址:https://www.cnblogs.com/Tommy-Yu/p/5818717.html
Copyright © 2011-2022 走看看