Solved

Is a byte value signed or unsigned?

Posted on 2011-09-12
4
431 Views
Last Modified: 2012-05-12
Is a byte value signed or unsigned?
byte x = 0xF4;
if (x == 244)
if (x == -11) 

Open in new window

will they both work?
0
Comment
Question by:deleyd
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
andrewjb earned 125 total points
ID: 36523588
Unsigned.

sbyte is signed.

So 'no' is your answer.
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 36523598
Byte variables are stored as unsigned 8-bit (1-byte) numbers ranging in value from 0 through 255
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 36523605
byte is an unsigned 8-bit integer, so on the example given only (x == 244) will return true.

byte (C# Reference)
http://msdn.microsoft.com/en-us/library/5bdb6693.aspx

0
 
LVL 12

Expert Comment

by:andrewjb
ID: 36523612
You could have probably googled "c# byte" faster than typing in this question :-)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now