2022.4.6

//2022.4.6
//#include<stdio.h>
//int main()
//{
//    // 使用short 修饰int 类型,表示短整型,占用的内存空间比int 小 表示数的范围比int 小
//    short int num = 100;
//
//    
//    printf("num = %d\n", num);
//
//    return 0;
//}

//#include<stdio.h> 
//int main()
//{
//    // 使用short 修饰int 类型,表示短整型,占用的内存空间比int 小 表示数的范围比int 小
//    short int num = -100;
//
//
//    printf("num = %d\n", num);
//
//    return 0;
//}

//#include<stdio.h>
//int main()
//{
//    // 使用long 修饰int 类型,表示长整型,占用的内存空间比int 小 表示数的范围比int 大
//    long int num = 1000;
//
//
//    printf("num = %d\n", num);
//
//    return 0;
//}
//
//#include<stdio.h>
//int main()
//{
//    // 使用long 修饰int 类型,表示长整型,占用的内存空间比int 小 表示数的范围比int 大
//    long  num = 1000;
//
//
//    printf("num = %d\n", num);
//
//    return 0;
//}

//#include<stdio.h>
//int main()
//{
//    // 使用short 修饰int 类型,表示短整型,占用的内存空间比int 小 表示数的范围比int 小
//    short  num = 100;
//
//    
//    printf("num = %d\n", num);
//
//    return 0;
//}

//#include<stdio.h>
//int main()
//{
//    // 使用unsigned 修饰一个非负的整数 age 属羊的 业务逻辑
//    unsigned short num = 500;
// 
//    
//    printf("num = %d\n", num);
//
//    return 0;
//}

/* toobig.c -- 超出系统允许的最大int值 */// unsigned
#include<stdio.h>
int main()
{
    int i = 2147483647;
    unsigned int j = 4294967295;

    printf("%d  %d  %d\n", i, i + 1, i + 2);
    printf("%u  %u  %u\n", j, j + 1, j + 2);

    
    return 0;
}

/* printf2.c -- 更多printf()值 */
//#include<stdio.h>
//int main()
//{
//    
//    unsigned int un = 3000000000; /* int为32位和short 16位的系统 */
//    short end = 200;
//    long big = 65537;
//    long long verybig = 12345678908642;
//    // sizeof()运算符,作用是计算整数类型的大小,单位是字节,
//
//    printf("un = %u and not %d\n", un, un);
//    printf("end = %hd and %d\n", end, end);
//    printf("big = %ld and not %hd\n", big, big);
//    printf("verybig = %lld and not %ld\n", verybig, verybig);
//
//    return 0;
//}

/* printf2.c -- 更多printf()值 */
//#include<stdio.h>
//int main()
//{
//
//    unsigned int un = 3000000000; /* int为32位和short 16位的系统 */
//    short end = 200;
//    long big = 65537;
//    long long verybig = 12345678908642;
//    // sizeof()运算符,作用是计算整数类型的大小,单位是字节,
//    // int -----4 byte = 32bit 
//    // short    2 byte = 16bit
//    //  long    4 byte = 32bit
//    // long long 8 byte = 64 bit
//    printf("int size = %d\n", sizeof(int));
//    printf("int size = %d\n", sizeof(short));
//    printf("int size = %d\n", sizeof(long));
//    printf("int size = %d\n", sizeof(long long));
//
//    
//    return 0;
//}

//#include<stdio.h>
//int main()
//{
//
//    unsigned int un = 3000000000; /* int为32位和short 16位的系统 */
//    short end = 200;
//    long big = 65537;
//    long long verybig = 12345678908642;
//
//    // sizeof()运算符,作用是计算整数类型的大小,单位是字节,
//    // int -----4 byte = 32bit 
//    // short    2 byte = 16bit
//    //  long    4 byte = 32bit
//    // long long 8 byte = 64 bit
//    printf("int size = %d\n", sizeof(int));
//    printf("short size = %d\n", sizeof(short));
//    printf("long size = %d\n", sizeof(long));
//    printf("long long size = %d\n", sizeof(long long));
//    
//    return 0;
//}

//#include<stdio.h>
//int main()
//{
//
//
//    char ch = 65; // 8bit
//    
//    printf("int size = %d\n", sizeof(char));
//    printf("ch = %c\n", ch);
//    return 0;
//}

//#include<stdio.h>
//int main()
//{
//
//
//    char ch = 'A'; // 8bit
//
//    printf("int size = %d\n", sizeof(char));
//    printf("ch = %c\n", ch);
//    return 0;
//}


//#include<stdio.h>
//int main()
//{
//
//
//    char ch = 100; // 8bit
//
//    printf("int size = %d\n", sizeof(char));
//    printf("ch = %c\n", ch);
//    return 0;
//}


//#include<stdio.h>
//int main()
//{
//
//
//    char ch = 7; // 8bit
//
//    printf("int size = %d\n", sizeof(char));
//    printf("ch = %c\n", ch);
//    return 0;
//}

//#include<stdio.h>
//int main()
//{
//
//
//    char ch = '\a'; // 8bit
//
//    printf("int size = %d\n", sizeof(char));
//    printf("ch = %c\n", ch);
//    printf("Gramps sez, \"a\\ is a back slash.\"\n");
//    return 0;
//}

//#include<stdio.h>
//int main()
//{
//
//
//    char ch = '\012'; // 8bit
//
//    printf("int size = %d\n", sizeof(char));
//    printf("ch = %o\n", ch);
//    printf("Gramps sez, \"a\\ is a back slash.\"\n");
//    return 0;
//}

//#include<stdio.h>
//int main()
//{
//
//
//    char ch = '\n'; // 8bit
//
//    printf("int size = %d\n", sizeof(char));
//    printf("ch = %o\n", ch);
//    printf("Gramps sez, \"a\\ is a back slash.\"\n");
//    return 0;
//}


/* charcode.c --显示字符的代码编号 */
#include<stdio.h>
int main()
{
    char ch;

    printf("Please enter a character.\n");
    scanf("%c",&ch);/*  用户输入字符 */
    printf("The code for %c is %d is %d.\n", ch, ch);

    
    return 0;
}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值