找到数据类型的大小 [英] Find the size of a datatype

查看:100
本文介绍了找到数据类型的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello all

假设我有一个数据类型在C中说X.如何在不声明该类型的变量或指针变量的情况下找到它的大小

,并且

当然没有使用sizeof运算符。

解决方案

Rahul K写道:

假设给出了一个数据类型,用C表示X.如何在不声明该类型的变量或指针变量的情况下找到它的大小
,而不使用sizeof运算符。




谁在乎呢?使用`sizeof`,这就是/它的原因。

-

Chris" electrick hedgehog" Dollin

报价设施包括缺乏原创思想。 /华丽之夜/




Rahul K写道:

你好所有
假设我给了一个数据类型,用C表示X.如何在不声明该类型的变量或指针变量的情况下找到它的大小
,当然不使用sizeof运算符。




为什么当然,为什么没有`sizeof`。

之后,这就是它的用途。


留给你的一个办法似乎是为了>代码中的
类型定义(或查看内置类型的B标准的C标准)并手动计算它。


Rahul K写道:


大家好。
假设我有一个数据类型在C中说X.我怎么能找到它的大小
没有声明该类型的变量或指针变量,并且当然不使用sizeof运算符。




你可以用幸运的猜测来做到这一点。 />

-

pete


Hello all
Suppose I am given a datatype say X in C. How can i find its size
without declaring a variable or pointer variable of that type, and of
course without using sizeof operator.

解决方案

Rahul K wrote:

Suppose I am given a datatype say X in C. How can i find its size
without declaring a variable or pointer variable of that type, and of
course without using sizeof operator.



Who cares? Use `sizeof`, that''s what it''s /for/.

--
Chris "electrick hedgehog" Dollin
"A facility for quotation covers the absence of original thought." /Gaudy Night/



Rahul K wrote:

Hello all
Suppose I am given a datatype say X in C. How can i find its size
without declaring a variable or pointer variable of that type, and of
course without using sizeof operator.



Why "of course", and why without `sizeof`. That''s what it''s for, after
all.

One recourse remaining to you seems to be grepping/eyeballing for the
type definition in the code (or looking into the C Standard for
built-in types) and figuring it "manually".


Rahul K wrote:


Hello all
Suppose I am given a datatype say X in C. How can i find its size
without declaring a variable or pointer variable of that type, and of
course without using sizeof operator.



You can do it with lucky guess.

--
pete


这篇关于找到数据类型的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆