当前位置:网站首页>整数溢出和打印
整数溢出和打印
2022-07-29 05:09:00 【Ryan菲特】
整数溢出和打印
%u说明显示unsigned int 类型的值
#include <stdio.h>
int main(void)
{
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;
}输出结构
2147483647 -2147483648 -2147483647
4294967295 0 1打印short、long、long long、unsigned类型
%ld用来打印long类型的值
%lx用来打印以十六进制格式表示的long类型的值
%lo用来打印以八进制格式表示的long类型的值
%hd表示以十进制显示short类型的整数
%ho表示以八进制显示short类型的整数
%lu表示打印unsigned long类型的值
%lld表示有符号的long long类型的值
%llu表示无符号的long long类型的值
#include <stdio.h>
int main(void)
{
unsigned int un = 300000000;
short end = 200;
long big = 65537;
long long verybig = 12345678908642;
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;
}运行结果
un = 3000000000 and not -1294967296
end = 200 and 200
big = 65537 and not 1
verybig = 12345678908642 and not 194289938这种输出只有在特定的系统中才会有以下结果
边栏推荐
- Alibaba cloud architect Liang Xu: MES on cloud box helps customers quickly build digital factories
- Helm chart for Kubernetes
- Thousands of databases, physical machines all over the country, JD logistics full volume cloud live record | interview with excellent technical team
- 数千个数据库、遍布全国的物理机,京东物流全量上云实录 | 卓越技术团队访谈录
- [event preview] cloud development, efficient and intelligent - the second Alibaba cloud ECS cloudbuild developer competition is about to start
- osgSimplegl3例子分析
- 如视技术副总裁杨永林:当传统产业遇到“数字空间”
- 最新坦克大战2022-全程开发笔记-2
- C how to realize simple factory mode
- MySQL的详细安装使用教程(保姆式安装图文讲解)
猜你喜欢

365天挑战LeetCode1000题——Day 041 二分查找完结纪念 + 第 N 个神奇数字 + 在线选举

Li Yan, CEO of parallel cloud: cloudxr, opens the channel to the metauniverse

OCCT学习003-----MFC单文档工程

The latest tank battle 2022 full development notes-1

Live broadcast Preview: integration of JD cloud Devops and jfrog product library

平行云CEO 李岩:CloudXR ,开启通往元宇宙的通道

Xiaobai high salary shortcut Qt development game Snake

Helm chart for Kubernetes

浅谈AspectJ框架

Database course design of online assistant teaching platform for high school chemistry
随机推荐
How rimworld uploads creative workshops through steamcmd
阿里云架构师梁旭:MES on 云盒,助力客户快速构建数字工厂
Helm chart for Kubernetes
Custom QML control: imagebutton
Young freshmen yearn for more open source | here comes the escape guide from open source to employment!
About realizing page Jump of website in Servlet
OCCT学习001-----简介
京东云联合Forrester咨询发布混合云报告 云原生成为驱动产业发展新引擎
ARFoundation从零开始5-AR图像跟踪
Database course design of online assistant teaching platform for high school chemistry
千人规模互联网公司研发效能成功之路
ARFoundation从零开始9-AR锚点(AR Anchor)
数据泄漏、删除事件频发,企业应如何构建安全防线?
Deadlock analysis using jstack, jconsole, and jvisualvm
C语言宏#define命令练习
Qml类型:State 状态
ARFoundation从零开始8-Geospatial API(地理空间)开发
01-01-osg GL3 环境搭建
什么是_GLIBCXX_VISIBILITY(default)
Getting started with solidity