当前位置:网站首页>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;
}边栏推荐
猜你喜欢

文件IO(1)

R和RStudio下载安装详细步骤

Unity technical manual - shape sub module - Sprite, spriterenderer and velocity over lifetime

Different methods of PivotTable in SQL tutorial

基于SqlSugar的开发框架循序渐进介绍(9)-- 结合Winform控件实现字段的权限控制

当 Pandas 遇见 SQL,一个强大的工具库诞生了

web技术分享| 【高德地图】实现自定义的轨迹回放

Pycharm installation tutorial, super detailed

Solve the problem that Preview PDF cannot be downloaded

解决audio自动播放无效问题
随机推荐
Bugs encountered in Oracle
Successful experience of postgraduate entrance examination in materials and Chemical Engineering (metal) of Beijing University of Aeronautics and Astronautics in 2023
JVM简单入门-02
2021-05-11 instanceof and type conversion
2021-05-11 abstract class
NOI OJ 1.3 13:反向输出一个三位数 C语言
一个优秀速开发框架是什么样的?
How to solve the problem that easycvr does not display the interface when RTMP streaming is used?
SQL教程之SQL 中数据透视表的不同方法
laravel8 beanstalk 使用说明
2021-04-12 the first implementation of linked list!!!
Confessing with Snake games (with source code)
Cloud native database Amazon RDS
JS教程之 什么是 JSX?为什么我们需要它?
5 login failures, limiting login practice
2021-04-27类和对象
Pycharm installation tutorial, super detailed
2021-04-27 classes and objects
How does thymeleaf get the value of the request parameter in the URL?
2021-04-12 链表第一次实现!!!