当前位置:网站首页>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
边栏推荐
- In depth analysis of common cross end technology stacks of app
- 数组学习之入门简单题 两数之和
- OCCT学习001-----简介
- 终端shell常用命令
- QML control: combobox
- 串口通讯部分详解
- QT series - Installation
- 阿里云架构师梁旭:MES on 云盒,助力客户快速构建数字工厂
- 数千个数据库、遍布全国的物理机,京东物流全量上云实录 | 卓越技术团队访谈录
- JD cloud and Forrester consulting released a hybrid cloud report that cloud Nativity has become a new engine driving industrial development
猜你喜欢

直播预告|如何通过“智能边缘安全”提升企业免疫力?

365天挑战LeetCode1000题——Day 037 元素和小于等于阈值的正方形的最大边长 + 满足条件的子序列数目

京东云金秋上云特惠进行中!扫码参与活动

英伟达周锡健:设计到数字营销的最后一公里

【C语言系列】— 一道递归小题目

In depth analysis of common cross end technology stacks of app

【C语言系列】— 打印100~200之间的素数

Live broadcast preview | how to save 30% labor cost and shorten 80% trademark processing cycle?

R & D efficiency | analysis of kubernetes' core technology and Devops' landing experience

C语言 一级指针
随机推荐
数组学习之入门简单题 两数之和
C语言数组典型应用代码详细讲解—高手误入(逐步代码详解)
【C语言系列】— 把同学弄糊涂的 “常量” 与 “变量”
浅谈范式
京东云联合Forrester咨询发布混合云报告 云原生成为驱动产业发展新引擎
Best practices for elastic computing in the game industry
Live broadcast preview | how to save 30% labor cost and shorten 80% trademark processing cycle?
【C语言系列】—三种方法模拟实现strlen库函数的方法
QtCreator+CMake编译器设置
Li Yan, CEO of parallel cloud: cloudxr, opens the channel to the metauniverse
Day 2
分配内存:malloc()和free()
OCCT学习001-----简介
【剑指offer】— 详解库函数atoi以及模拟实现atoi函数
C语言文件操作
Alibaba cloud architect details nine trends in the game industry
Cryengine Technology
167. 两数之和 II - 输入有序数组
CMU15-213 Shell Lab实验记录
来!看排名一年上升16位的ClickHouse,如何在京东落地实践