当前位置:网站首页>Integer lifting example
Integer lifting example
2022-06-11 09:43:00 【Life is made by oneself ~】
1️⃣ Integers are all in memory 32 A bit , It's just that if it is char Truncation occurs for this type of ( Be careful to convert it into a complement )
2️⃣ Integer promotion depends on type promotion signed Just add the sign bit unsigned char Just add 0
3️⃣ A positive number 、 back 、 Complement the same
int main()
{
char a = -1;
signed char b = -1;
unsigned char c = -1;
printf("a = %d, b = %d, c = %d", a, b, c);
return 0;
}
To do this problem, you must first know signed char and unsigned char The scope of the
signed char

unsigned char

So I'm looking at this problem , Use all three %d In the form of printing , So there will be plastic improvement
char a:
signed char and char It is equivalent. 
answer -1 , -1, 255
int main()
{
char a = -128;
char b = 128;
printf("%u\n", a);
printf("%u\n", b);
return 0;
}


answer : 4294967168, 4294967168
int main()
{
int i = -20;
unsigned int j = 10;
printf("%d\n", i + j);
return 0;
}
We need to know the priority order before we do this problem
long double
double
float
unsigned long int
long int
unsigned int
int

Operate in the form of complement , Finally, it is formatted as a signed integer
answer : -10
边栏推荐
- 报错[DetectionNetwork(1)][warning]Network compiled for 6 shaves,maximum available 10,compiling for 5 s
- Augmented reality experiment IV of Shandong University
- 我们是如何连上WiFi的?
- [ROS] noedic moveit installation and UR5 model import
- Image quality evaluation including Matlab source code
- Where is it safer to open an account for soda ash futures? How much can soda ash futures do now?
- JS foundation - array object
- 1854. the most populous year
- ORACLE DG物理备库使用别名数据文件改变路径到OMF路径
- Simulation of map and set
猜你喜欢

Openstack explanation (XXIII) -- other configurations, database initialization and service startup of neutron

MSF SMB based information collection

How to determine whether two time periods overlap?

The difference and relation between machine learning and statistics

FPGA基础架构【参考ug998】

JS foundation -- about DOM

不同CV任务的标注类型

Document object

ORA-00059 超过db_files限制

Opencv CEO teaches you to use oak (IV): create complex pipelines
随机推荐
Error [detectionnetwork (1)][warning]network compiled for 6 shapes, maximum available 10, compiling for 5 S
Version mismatch between installed deeply lib and the required one by the script
Control statement if switch for while while break continue
Day 47 how to query a table
Openstack explanation (22) -- neutron plug-in configuration
Opencv CEO teaches you to use oak (IV): create complex pipelines
Understanding of the keyword this in JS
Before applying data warehouse ODBC, you need to understand these problems first
Technical practice of dolphin dispatching in kubernetes system
Document object
How do online app stores of laundry chain stores do?
12.5 concurrent search + violent DFS - [discovery ring]
keyboard entry.
ESP8266_ Connect to Alibaba cloud through mqtt protocol
Tissu. JS définit dynamiquement la taille de la police
考研數學 【數列極限證明題】題型方法總結
Type-C Bluetooth speaker single port rechargeable OTG solution
Oracle 11g RAC disk group has space and cannot add data files?
GDB debugging common commands
Package details