当前位置:网站首页>005:整型数据类型存储空间大小
005:整型数据类型存储空间大小
2022-07-21 05:15:00 【龙星尘】
005:整型数据类型存储空间大小
总时间限制:
1000ms
内存限制:
65536kB
描述
分别定义int,short类型的变量各一个,并依次输出它们的存储空间大小(单位:字节)。
输入
无。
输出
一行,两个整数,分别是两个变量的存储空间大小,用一个空格隔开。
样例输入
(无)
样例输出
(不提供)
提示
使用sizeof函数可以得到一个特定变量的存储空间大小。例如:对于int型变量x,sizeof(x)的值为4,即x的存储空间为4字节
这道题简单到老家了,提示上都给了sizeof函数,可以得到一个特定变量的存储空间大小,不就是题目要求吗?直接往里面套就是了。
我的代码:
#include <iostream>
using namespace std;
int main()
{
printf("%d %d\n",sizeof(int),sizeof(short));
return 0;
}
短短7行,直接搞定好吧,简直是送分题等会儿一并讲解006.
边栏推荐
- 01背包面试题系列(一)
- 概率论-最大似然估计
- 火爆社区的开源数据可视化工具 datart 新用户体验教程
- 为什么不用定时任务实现关闭订单?
- 你真的懂01背包问题吗?01背包的这几问你能答出来吗?
- 10 classic C language interview basic algorithms
- 超级实用的12条 SQL 优化方案
- Does NMN product really have its effect? What effect does it have after taking NMN for several months
- . Net memory leakage causes and Solutions
- datart 数据可视化作品开源 | 图表插件作品全开源啦,通过百度云下载链接提取
猜你喜欢
Do you think sub database and sub table are really suitable for your system? Talk about how to select sub databases, sub tables and newsql
The robotframework (ride) keyword cannot be used or the keyword is black
Visual studio tips, functions and features
轻松自制PASCAL VOC数据集
一起学习gcc gdb makefile
Concurrency opening -- take you from 0 to 1 to build the cornerstone of concurrency knowledge system
西瓜书第二章-比较检验
Further learning of 02 selenium (control browser window +)
Using tornado to realize local chat room
面试题:聚簇索引和非聚簇索引有什么区别?
随机推荐
The robotframework (ride) keyword cannot be used or the keyword is black
What is a direct drinking machine? What is its working principle and advantages?
面试官:你的update 更新影响行数做判断了吗?
西瓜书第二章笔记-评估方法
What are the problems in the classification and future development of IOT devices?
使用MySQL,请善用 JSON 这张牌
Appium+pytest+allure realizes app automated testing, which is a small test
轻松自制PASCAL VOC数据集
Source Insight 4.0个性化设置及快捷键
Robotframework -- implementation of browser drive and operation (1)
牛客网刷题总结--面试必刷top101
Does NMN product really have its effect? What effect does it have after taking NMN for several months
02-selenium的进一步学习(控制浏览器窗口+)
西瓜书第二章笔记-性能度量
Learning notes for beginners to OpenGL (II) Download glew, configure the environment of glew and initialization of glew
Concurrency opening -- take you from 0 to 1 to build the cornerstone of concurrency knowledge system
Liteos connector script (2)
844. 比较含退格的字符串
Task and Await: Consuming Awaitable Methods
Google Chrome -- xpathhelper installation