当前位置:网站首页>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;
}
边栏推荐
- B / Qurt Utilisateur Guide (36)
- Ora-01741 and ora-01704
- Summary of common methods of object class (September 14, 2020)
- UE4_ Use of ue5 blueprint command node (turn on / off screen response log publish full screen display)
- 移动端异构运算技术 - GPU OpenCL 编程(基础篇)
- B_ QuRT_ User_ Guide(37)
- As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
- 【7.4】25. K 个一组翻转链表
- Slam interview summary
- Access database query all tables SQL
猜你喜欢
Live server usage
The file format and extension of XLS do not match
Oracle database backup and recovery
Anxin can internally test offline voice module vb-01 to communicate with esp-c3-12f
As a new force, chenglian premium products was initially injected, and the shares of relevant listed companies rose 150% in response
C method question 1
Svn relocation
UE4_ Ue5 combined with Logitech handle (F710) use record
Arbre binaire équilibré [Arbre AVL] - Insérer et supprimer
SAP HR 家庭成员信息
随机推荐
C simple question one
B_QuRT_User_Guide(37)
[experiment sharing] log in to Cisco devices through the console port
C method question 1
Anti climbing means cracking the second
Installing gradle
Extract the file name under the folder under win
First week of July
【leetcode】day1
[summary] some panels and videos seen
B_QuRT_User_Guide(36)
Navicat connects Oracle
postgis学习
生鲜行业数字化采购管理系统:助力生鲜企业解决采购难题,全程线上化采购执行
USB (XVI) 2022-04-28
LM12丨Rolling Heikin Ashi二重K线滤波器
Progress broadcast | all 29 shield machines of Guangzhou Metro Line 7 have been launched
Understand TCP's three handshakes and four waves with love
Have all the fresh students of 2022 found jobs? Is it OK to be we media?
SAP HR奖罚信息导出