当前位置:网站首页>C language -- printf print base prefix
C language -- printf print base prefix
2022-06-29 16:14:00 【Please trust me】
problem
Here is a tip to share with you , For some topics, we are required to print the following format
octal : 020 0144 0213
Hexadecimal :0x231 0x231 0x64
It's simple , We just need to print at the end , Declare the print type of the printed variable .
octal :%o
Hexadecimal :%x
Unfortunately, the final result is wrong !!!
as follows 
The result we print out has no base prefix
What shall I do? ?
solve
Use C Language specifier , To print these prefixes
Code
#include<stdio.h>
/* octal : %#o Hexadecimal : %#x or %#X */
int main(void)
{
int x=100;
printf("dec = %d; octal = %#o ; hex = %#x or hex = %#X \n",x,x,x);
return 0;
}
result

It is also a small skill , What if it works one day
边栏推荐
- Tutorial | fNIRS data processing toolkit homer2 download and installation
- golang操作etcd
- MATLAB输出格式控制 %d,%f,%c,%s的用法
- How to add a search box to your WordPress site
- 高级性能测试工程师面试必问十大问题
- Time format GTM to Beijing time
- Key sprite fighting monsters - window binding skill
- MySQL进阶——存储引擎
- 元数据管理Apache Atlas编译集成部署及测试
- 按键精灵打怪学习-窗口绑定保护技能和点击技能
猜你喜欢

leetcode:535. TinyURL 的加密与解密【url和id的映射,id自增】

论文笔记:E(n) Equivariant Graph Neural Networks

加速智能驾驶项目落地?你还缺一套真值测评系统

小程序在产业互联网有「大」作为

卫龙辣条第三次冲刺上市:业绩增速下滑,刘卫平、刘福平提前套现

Timecho of Tianmou technology completed Angel round financing of nearly RMB 100 million and built the original time series database of the industrial Internet of things around Apache iotdb
![leetcode:535. Encryption and decryption of tinyurl [mapping of URL and ID, ID self increment]](/img/16/6684eaadc949e27c66a742100cb8f8.png)
leetcode:535. Encryption and decryption of tinyurl [mapping of URL and ID, ID self increment]

The latest agenda of dtcc2022 China database technology conference was released

It is expected to significantly improve the computational performance of integrated photonic circuits. The Tsinghua team proposed a diffraction pattern neural network framework

隐私计算助力数据的安全流通与共享
随机推荐
论文笔记:E(n) Equivariant Graph Neural Networks
隐私计算助力数据的安全流通与共享
Mysql database foundation: DDL data definition language
Cerebral Cortex:从任务态和静息态脑功能连接预测儿童数学技能
挖财学堂证券开户安全嘛?
leetcode:42. Rain water [double hands are elegant]
【Try to Hack】XML
进阶 | webgl性能优化初尝
Science: the interrelated causes and consequences of sleep in the brain
C11新特性——auto、decltype类型指示符
UWB精准定位方案,厘米级高精度技术应用,智能配对感应技术
有哪些顶级水平的中国程序员?
破解湖+仓混合架构顽疾,星环科技推出自主可控云原生湖仓一体平台
golang操作etcd
DTCC2022 中国数据库技术大会最新议程出炉
小程序在产业互联网有「大」作为
Sophon kg upgrade 3.1: break down barriers between data and liberate enterprise productivity
Sophon Base 3.1 推出MLOps功能,为企业AI能力运营插上翅膀
golang操作NSQ分布式消息队列
TLBB series of Tianlong Babu - online single use database modified to other sects