当前位置:网站首页>Integer overflow and printing
Integer overflow and printing
2022-07-29 05:28:00 【Ryan fitter】
Integer overflow and printing
%u Description display unsigned int Type value
#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;
}Output structure
2147483647 -2147483648 -2147483647
4294967295 0 1Print short、long、long long、unsigned type
%ld For printing long Type value
%lx Used to print in hexadecimal format long Type value
%lo Used to print in octal format long Type value
%hd Indicates display in decimal short Type integer
%ho Indicates that it is displayed in octal short Type integer
%lu Means to print unsigned long Type value
%lld It means signed long long Type value
%llu To represent an unsigned long long Type value
#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;
}Running results
un = 3000000000 and not -1294967296
end = 200 and 200
big = 65537 and not 1
verybig = 12345678908642 and not 194289938This output can only have the following results in a specific system
边栏推荐
- 数千个数据库、遍布全国的物理机,京东物流全量上云实录 | 卓越技术团队访谈录
- 【C语言系列】— 把同学弄糊涂的 “常量” 与 “变量”
- 分配内存:malloc()和free()
- 哈夫曼树以及哈夫曼编码在文件压缩上的应用
- Container security open source detection tool - veinmind (mirror backdoor, malicious samples, sensitive information, weak password, etc.)
- 浅谈Servlet
- Come on! See how Clickhouse, which has risen 16 places a year, can be implemented in jd.com
- QML custom tabbar
- 【C语言系列】— 一道递归小题目
- 【C语言系列】—三种方法模拟实现strlen库函数的方法
猜你喜欢
随机推荐
Teardown's method of lifting the time limit
适创科技以云仿真平台,支持“中国智造”升级
167. 两数之和 II - 输入有序数组
三次握手四次挥手针对面试总结
365天挑战LeetCode1000题——Day 038 公交站间的距离 + 基于时间的键值存储 + 转变数组后最接近目标值的数组和 + 有界数组中指定下标处的最大值
重定向和文件
GPIO的输入输出详解
365天挑战LeetCode1000题——Day 041 二分查找完结纪念 + 第 N 个神奇数字 + 在线选举
【C语言系列】—文件操作详解(上)
Complete ecological map of R & D Efficiency & selection of Devops tools
Allocate memory: malloc() and free()
365天挑战LeetCode1000题——Day 040 设计跳表 + 避免洪水泛滥 + 查找大小为 M 的最新分组 + 销售价值减少的颜色球
Cryengine3 debugging shader method
JD cloud golden autumn cloud special offer is in progress! Code scanning participation activities
京东云分布式链路追踪在金融场景的最佳实践
In depth analysis of common cross end technology stacks of app
C language handwritten qq-ai version
数据库操作 Day 6
抽象类与接口
C language first level pointer









