当前位置:网站首页>NOI OJ 1.2 10:Hello, World! Size of C language
NOI OJ 1.2 10:Hello, World! Size of C language
2022-06-23 10:29:00 【chd44】
describe
Remember in the last chapter , We have output “Hello, World!” Do you ?
Although it is not the basic data type involved in this chapter , But we can also use sizeof Function to get the size of the space it occupies .
Please program to find its size , See if it's the same as you think ?
Input
nothing .
Output
An integer , namely “Hello, World!” Size .
Let's start with an obvious error demonstration ( Don't spray )
#include<stdio.h>;
int main(){
char a=" Hello, World!";
printf("%d",sizeof(a));
return 0;
}This is the error code !!!!!!!!!!!
char Is used to store character data , example :'x' and '*'
Here, " Hello, World!" Obviously beyond this range , So we don't have to use char To declare , We can output directly sizeof(" Hello, World!"), The resulting value is an integer , You can export it directly .
Correct code :
#include<stdio.h>
int main(){
printf("%d",sizeof("Hello, World!"));
return 0;
}边栏推荐
- 解决预览pdf不能下载的问题
- Pycharm installation tutorial, super detailed
- 2021-04-12 the first implementation of linked list!!!
- 【第23天】给定一个长度为 n 的数组,将元素 X 插入数组指定的位置 | 数组插入操作4
- 2021-04-16递归
- [day 23] given an array of length N, insert element x into the position specified by the array | array insertion operation 4
- NOI OJ 1.3 04:带余除法 C语言
- 2021-05-07 constructor
- Golang quick start (1)
- 2021-05-11 static keyword
猜你喜欢
随机推荐
Too helpless! Microsoft stopped selling AI emotion recognition and other technologies, saying frankly: "the law can not keep up with the development of AI"
RT thread add MSH command
2021-05-12 interface definition and Implementation
Five SQL functions for operation date that must be known in SQL tutorial
同花顺推荐么?手机开户安全么?
Unity技术手册 - 形状(Shape)子模块 - Sprite、SpriteRenderer及生命周期内速度(Velocity over Lifetime)
安装typescript环境并开启VSCode自动监视编译ts文件为js文件
实现领域驱动设计 - 使用ABP框架 - 通用准则
Unity technical manual - lifecycle lifetimebyemitterspeed - color in the cycle coloroverlifetime- speed color colorbyspeed
Description of directory files of TLBB series of Tianlong Babu - netbill server [ultra detailed]
Mysql 的Innodb引擎和Myisam数据结构和区别
Golang 快速上手 (3)
web技术分享| 【高德地图】实现自定义的轨迹回放
数值计算方法
NOI OJ 1.4 01:判断数正负 C语言
Liujinhai, architect of zhongang Mining: lithium battery opens up a Xintiandi for fluorine chemical industry
NOI OJ 1.3 11:计算浮点数相除的余数 C语言
Experience of using thread pool in project
当 Pandas 遇见 SQL,一个强大的工具库诞生了
几款实用软件分享









