当前位置:网站首页>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;
}
边栏推荐
- UE4_ Ue5 panoramic camera
- SAP memory parameter tuning process
- Ora-02437 failed to verify the primary key violation
- B_ QuRT_ User_ Guide(40)
- 进度播报|广州地铁七号线全线29台盾构机全部完成始发
- Force deduction solution summary 648 word replacement
- Installing gradle
- Explain
- 648. Word replacement
- Sequence of entity layer, Dao layer, service layer and controller layer
猜你喜欢

How to change the formula picture in the paper directly into the formula in word

Ora-01741 and ora-01704

Home appliance industry channel business collaboration system solution: help home appliance enterprises quickly realize the Internet of channels

Take you hand in hand to build Eureka server with idea

ASP. Net core middleware request processing pipeline

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

Take you hand in hand to build Eureka client with idea

0-1背包问题

Digital procurement management system for fresh food industry: help fresh food enterprises solve procurement problems and implement online procurement throughout the process

SAP HR social work experience 0023
随机推荐
MySQL Index Optimization Practice II
Anxin vb01 offline voice module access intelligent curtain guidance
MySQL架构
Illegal behavior analysis 1
B_QuRT_User_Guide(38)
USB (XVIII) 2022-04-17
B_QuRT_User_Guide(36)
Fibonacci number of dynamic programming
Explain
平衡二叉树【AVL树】——插入、删除
The 19th Zhejiang Provincial College Programming Contest 2022 f.easyfix chairman tree
redis缓存工具类,值得拥有~
B_QuRT_User_Guide(39)
Slam interview summary
Design and implementation of spark offline development framework
KeePass realizes automatic input of web pages
MySQL Architecture
One of the anti climbing methods
【汇总】看过的一些Panel与视频
电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级