当前位置:网站首页>C语言学习
C语言学习
2022-07-07 21:52:00 【Assass1n-】
C语言学习
1.定义常量
用法: #define 常量名 值
const 数据类型 常量名 =值
2.整型 int
打印格式
| 打印格式 | 含义 |
|---|---|
| %d | 输出一个有符号的十进制int类型 |
| %o(字母o) | 输出8进制的int类型 |
| %x | 输出16进制的int类型,字母以小写格式输出 |
| %X | 输出16进制的int类型,字母以大写格式输出 |
| %u | 输出一个10进制的无符号数 |
例子
#include <stdio.h>
int main(void)
{
//数据类型 标识符 =值
//无符号 unsigned 有符号 signed
signed a =-10;
//unsigned int a =10 这是可以正常显示 如果=-10时 会出现乱码
printf("%d\n",a);//此时 unsigned 可以正常输出-10
//printf("%u\n",a);
return 0;
}
#include <stdio.h>
int main(void)
{
int a=10;
printf("%d\n",a);//输出10
printf("%x\n",a);//输出a
printf("%X\n",a);//输出A
printf("%o\n",a);//输出12
//定义八进制数据以0开头
int b =0123;
//定义16进制数据 以0x开头
int c =0x123;
printf("%x\n",b);
printf("%X\n",b);
printf("%o\n",b);
printf("%x\n",c);
printf("%X\n",c);
printf("%o\n",c);
return 0;
}
边栏推荐
- 【汇总】看过的一些Panel与视频
- 2021icpc Shanghai h.life is a game Kruskal reconstruction tree
- Idea automatically generates serialVersionUID
- Solution of intelligent supply chain collaboration platform in electronic equipment industry: solve inefficiency and enable digital upgrading of industry
- B_QuRT_User_Guide(36)
- B_QuRT_User_Guide(37)
- UE4_ Use of ue5 blueprint command node (turn on / off screen response log publish full screen display)
- SLAM面试总结
- 生鲜行业数字化采购管理系统:助力生鲜企业解决采购难题,全程线上化采购执行
- Map operation execution process
猜你喜欢

Get started with mongodb

First week of July

SAP HR奖罚信息导出

PCB wiring rules of PCI Express interface
![[compilation principle] lexical analysis design and Implementation](/img/8c/a3a50e6b029c49caf0d791f7d4513a.png)
[compilation principle] lexical analysis design and Implementation

UE4_ Ue5 panoramic camera

SAP HR 劳动合同信息 0016

家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化

Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting

Three questions TDM
随机推荐
通达信买基金安全吗?
B_ QuRT_ User_ Guide(38)
【leetcode】day1
电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级
Progress broadcast | all 29 shield machines of Guangzhou Metro Line 7 have been launched
One of the anti climbing methods
[stm32+esp8266 connect Tencent cloud IOT development platform 2] stm32+esp8266-01s connect Tencent cloud
Home appliance industry channel business collaboration system solution: help home appliance enterprises quickly realize the Internet of channels
[summary] some panels and videos seen
谷歌浏览器怎么登录及开启同步功能
As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
One week learning summary of STL Standard Template Library
MySQL Index Optimization Practice II
Happy gathering time
0-1 knapsack problem
Anxinco esp32-a1s development board is adapted to Baidu dueros routine to realize online voice function
HDU 4747 mex "recommended collection"
Open source hardware small project: anxinco esp-c3f control ws2812
家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
C simple question 2