我如何声明一个字节变量? [英] How do i declare a byte variable?

查看:340
本文介绍了我如何声明一个字节变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个问题,一个愚蠢的问题。我不能声明一个类型的变量

byte。


g ++说我在这一行中有语法错误。代码是

这个:字节*变量;


好​​吧,我认为错误是愚蠢但我找不到它。 />
在哪里?



I have a problem, a stupid problem. I can''t declare a variable of type
byte.

The g++ said that i have syntactic error in this line. The code is
this: byte * variable;

well, i think that the mistake is a stupidity but i don''t find it.
where is it?

推荐答案

Manuel写道:
Manuel wrote:




我有一个问题,一个愚蠢的问题。我不能声明一个类型的变量

byte。


g ++说我在这一行中有语法错误。代码是

这个:字节*变量;


好​​吧,我认为错误是愚蠢但我找不到它。 />
在哪里?


I have a problem, a stupid problem. I can''t declare a variable of type
byte.

The g++ said that i have syntactic error in this line. The code is
this: byte * variable;

well, i think that the mistake is a stupidity but i don''t find it.
where is it?



标准C ++没有称为byte的内置类型。只需使用一个

char或者可能是一个未签名的字符。


试试这个:


char * variable1 ;

unsigned char * variable2;


或许您需要告诉我们更多关于您打算做什么的事情

变量。


祝你好运,


Tom

Standard C++ doesn''t have a built-in type called "byte." Just use a
char or, possibly, an unsigned char.

Try this:

char* variable1;
unsigned char* variable2;

Or perhaps you need to tell us more about what you intend to do with
the variable.

Best regards,

Tom


On 2006年8月10日13:57:01 -0700 in comp.lang.c ++,Manuel

< mf ***** @ gmail.comwrote,
On 10 Aug 2006 13:57:01 -0700 in comp.lang.c++, "Manuel"
<mf*****@gmail.comwrote,

>我有一个问题,一个愚蠢的问题。我不能声明一个类型为
byte的变量。

g ++说我在这一行中有语法错误。代码是这样的:byte * variable;
>I have a problem, a stupid problem. I can''t declare a variable of type
byte.

The g++ said that i have syntactic error in this line. The code is
this: byte * variable;



C ++中的一个字节是char,或unsigned char,或者是signed char。


但是上面的变量不会是一个字节,任何情况。这将是一个指针

。如果你问的是什么是字节,你可能应该

现在避免使用字节和指针并使用std :: string等。

A byte in C++ is char, or unsigned char, or signed char.

But your variable above would not be a byte an any case. It would
be a pointer. If you are asking what is a byte, you should probably
avoid bytes and pointers for now and use std::string etc..

哎哟,我很愚蠢;(


好​​吧,我考虑过使用byte类型的变量,因为我需要

存储从0到0的值255.

我想我可以用这个:


Thomas Tutone写道:typedef unsigned char byte;

所以这样我可以使用字节。


感谢您的帮助。


再见。

Manuel Fernadez Campos
ouch, iam stupid ;(

well, I thought about using the variable of type byte because I need to
store values from 0 to 255.
I think that i can use this:

Thomas Tutone wrote: typedef unsigned char byte;
So this way i can use byte.

Thank you for your help.

Bye.
Manuel Fernadez Campos

Manuel写道:
Manuel wrote:

hi,


我有一个问题,一个愚蠢的问题。我不能声明一个类型的变量

byte。


g ++说我在这一行中有语法错误。代码是

这个:字节*变量;


好​​吧,我认为错误是愚蠢但我找不到我t。

在哪里?


I have a problem, a stupid problem. I can''t declare a variable of type
byte.

The g++ said that i have syntactic error in this line. The code is
this: byte * variable;

well, i think that the mistake is a stupidity but i don''t find it.
where is it?



标准C ++没有一个名为byte的内置类型。只需使用一个

char或者可能是一个未签名的字符。


试试这个:


char * variable1 ;

unsigned char * variable2;


或许您需要告诉我们更多关于您打算做什么的事情

变量。


祝你好运,

Tom


Standard C++ doesn''t have a built-in type called "byte." Just use a
char or, possibly, an unsigned char.

Try this:

char* variable1;
unsigned char* variable2;

Or perhaps you need to tell us more about what you intend to do with
the variable.

Best regards,

Tom


这篇关于我如何声明一个字节变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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