首页 > 编程语言 >编写一个程序以确定分别由signed及unsigned限定的char、short、int及long类型变量的取值范围。采用打印标准头文件中的相应值以及直接计算两种方式实现

编写一个程序以确定分别由signed及unsigned限定的char、short、int及long类型变量的取值范围。采用打印标准头文件中的相应值以及直接计算两种方式实现

时间:2023-04-07 17:33:06浏览次数:37  
标签:MIN int max unsigned signed char printf MAX

#include <stdio.h>
#include <limits.h>
main() {
    printf("采用打印标准头文件limits.h的相应值\n");
    //signer types
    printf("signed char min =%d\n", SCHAR_MIN);
    printf("signed char max =%d\n", SCHAR_MAX);
    printf("signed short min =%d\n", SHRT_MIN);
    printf("signed short max =%d\n", SHRT_MAX);
    printf("signed int min =%d\n", INT_MIN);
    printf("signed int max =%d\n", INT_MIN);
    printf("signed long min =%d\n", LONG_MIN);
    printf("signed long max =%d\n", LONG_MIN);

    //unsigned types

    printf("unsigned char max =%u\n", UCHAR_MAX);
    printf("unsigneed short max =%u\n", USHRT_MAX);
    printf("unsigned int max =%u\n", UINT_MAX);
    printf("unsigned long max =%u\n", ULLONG_MAX);
    system("pause");
    return 0;
}

 

标签:MIN,int,max,unsigned,signed,char,printf,MAX
From: https://www.cnblogs.com/cjxs0/p/17296900.html

相关文章

  • 给定一个list和一个int数值,循环打印固定范围内list的元素
    比如有一个list,里面有“1,2,3,4,5,6,7,8”这八个元素,再给一个int数值,比如是3,那打印结果就是第一次:1,2,3第二次:4,5,6第三次:7,8,1第四次:2,3,4依次类推...publicstaticvoidmain(String[]args){intstrength=3;List<Integer>indexList=new......
  • StringToByte(char* source, uint8_t* dest, int sourceLen)
    voidStringToByte(char*source,uint8_t*dest,intsourceLen){inti;uint8_thighByte,lowByte;for(i=0;i<sourceLen;i+=2){highByte=toupper(source[i]);lowByte=toupper(source[i+1]);if(highB......
  • JUC并发编程基础篇第五章之线程中断状态[你理解的线程中断,只会Thread.interrupted()
    目录1、什么是线程的中断机制2、isterruptinterruptedisInterrupted区别3、面试题3.1、如何停止中断运行中的线程3.2、当前线程的中断标识符为true,是不是线程就立马停止了3.3、如果线程处于被阻塞的状态(列入sleep,wait,join等状态),在别的线程调用当前线程的interrupt()方法,会发生......
  • [paper reading]|IC-FPS: Instance-Centroid Faster Point Sampling Module for 3D Po
    摘要:本文说首次实现了大规模点云场景中基于点的模型的实时检测(<30ms);首先指出FPS采样策略进行下采样是耗时的,尤其当点云增加的时候,计算量和推理时间快速增加;本文提出IC-FPS;包含两个模块:localfeaturediffusionbasedbackgroundpointfilter(LFDBF);CentroidInstanceSampl......
  • 【中文乱码】HttpServletResponse PrintWriter中文乱码解决方法
    HttpServletResponse使用PrintWriter输出中文的时候,如果不设置流的编码就会产生乱码,PrintWriter直接输出的字符流首先使用"response.setCharacterEncoding(charset)"设置字符以什么样的编码输出到浏览器,如果不设置则默认是ISO-8859-1,这个是不支持中文的。解决方法publicvoid......
  • PrintDocument DrawString C# 换行问题
    在使用80mm小票机做再次开发时使用DrawString无法自动换行导致文字被截断终于找到解决方案:别忘了给我点赞,留言源代码如下:立跑可用 链接:https://pan.baidu.com/s/1vywMUvGXMaFh_1o7ywDQTA?pwd=yyyy提取码:yyyy......
  • A C++ program that prints itself
    #include<iostream>usingnamespacestd;intmain(){strings="cout<<\"#include<iostream>\\nusingnamespacestd;\\n\\nintmain(){\\nstrings=\\\"\";\nfor(chari:s)\nif(i==�......
  • echarts 双y轴0刻度线对称
    第一步:分别找出双y轴的最大最小值constmax1=Math.max(...data1);constmin1=Math.min(...data1);constmax2=Math.max(...data2);constmin2=Math.min(...data2);第二步:计算两组数据范围的比值(相当于比例尺)constratio=(max1-min1)/(max2-min2);第三步:......
  • pycharm上安装pip
    网上的答案太花里胡哨了,简单一两个命令弄得长篇大论 查看是否安装pip,终端输入:pip--version如果显示:ModuleNotFoundError:Nomodulenamed'pip' 那就没有安装好 安装pip命令:python-mensurepip--default-pip然后再输入:pip--version 检查一下是否能显示版本号,能......
  • C#曲线图-chart
    publicForm1(){InitializeComponent();//不显示网格线chart1.ChartAreas[0].AxisX.MajorGrid.Enabled=false;//设置网格颜色chart1.ChartAreas[0].AxisY.MajorGrid.LineColor=Color.HotPink;......