对编码的理解和计算机存数据的理解

                            编码:计算机只认识0101,因此要把我们认识文字和英文字符转换为二进制数字。

                            整型常量分为 整数和字符,整数使用原码存储,字符在内存存取需要转换为数字,这个就是ASCII,当然还有各种中文编码,还有浮点数存取,这个复杂。

                           整型常量注意一个是使用unsigned 还是signed 区别,最高位明显不一样,实际编程用的大多是unsigned xxxx;

                          字符是离散的,先要通过ASCIII码转换为数字,然后存储。

                           

#include "common.h"
#include <stdio.h>
#include <stdlib.h>
 
static float test_point = 1.3435;
static int   normal_point = 1;


//8进制g
static int   test_data = 01000;
static char  signed_data = 0b01111111;
static unsigned char  unsigned_data = 0b11111111;
static char  full_signed_data = 0b11111111;
static char  A = 'a';



int main()
{
    char letter = '\a';
    char  test_data = 'abc';
    char* p_data = "hello world";
    //while (1) 
    // 代数式 -------------->   C语言表达式
    // 四舍五入
    char   expression = 2+3/1.2;
    {
        while (1)
        {
            //printf("%c\n", letter  000000 
            printf("expression is %d\n", expression);
            printf("signed_data is %d\n", signed_data);
            printf("unsigned_data is %d\n", unsigned_data);
            printf("full_signed_data is %d\n", full_signed_data);
            printf(" A  is %d\n", A);
            printf("sizeof float is %d\n", sizeof(float));
            // double  的大小 
            printf("sizeof double is %d\n", sizeof(double));
            
            
        //    free(p_data);
            printf("p_data is 0b%o\n", p_data);
            Sleep(1000);
        }
        printf("my first task\n");
    }

    return 0;
} 

一勤天下无难事。
原文地址:https://www.cnblogs.com/nowroot/p/12367567.html