当前位置:网站首页>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;
}
边栏推荐
- JNI uses asan to check memory leaks
- SAP HR 家庭成员信息
- [untitled]
- Come on, brother
- SAP HR reward and punishment information export
- Arbre binaire équilibré [Arbre AVL] - Insérer et supprimer
- SAP HR labor contract information 0016
- Anxinco esp32-a1s development board is adapted to Baidu dueros routine to realize online voice function
- Anxin vb01 offline voice module access intelligent curtain guidance
- System design overview
猜你喜欢

New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held

Anxinco EC series modules are connected to the multi protocol access products of onenet Internet of things open platform

List. How to achieve ascending and descending sort() 2020.8.6

Take you hand in hand to build feign with idea

平衡二叉樹【AVL樹】——插入、删除

城联优品作为新力量初注入,相关上市公司股价应声上涨150%

Understand TCP's three handshakes and four waves with love

Three questions TDM

SAP HR reward and punishment information export

C simple question one
随机推荐
B_QuRT_User_Guide(39)
Unity3d learning notes 5 - create sub mesh
SAP memory parameter tuning process
Home appliance industry channel business collaboration system solution: help home appliance enterprises quickly realize the Internet of channels
The 19th Zhejiang Provincial College Programming Contest VP record + supplementary questions
Anti climbing means cracking the second
Lm12 rolling heikin Ashi double K-line filter
【7.5】15. 三数之和
ASP. Net core middleware request processing pipeline
电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级
First week of July
Get started with mongodb
Understand TCP's three handshakes and four waves with love
Take you hand in hand to build Eureka server with idea
Force deduction solution summary 648 word replacement
The file format and extension of XLS do not match
Installing gradle
城联优品作为新力量初注入,相关上市公司股价应声上涨150%
谷歌浏览器怎么登录及开启同步功能
How to login and enable synchronization function in Google browser