首页 技术 正文
技术 2022年11月16日
0 收藏 485 点赞 2,749 浏览 973 个字

关键字

数据类型:
  简单(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

  

数据类型示意图:

    linux c 笔记-3 c语言基础知识

  

流程控制:
  条件跳转(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\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

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,156
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,624
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,468
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,240
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,876
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,043