Solved

Is a byte value signed or unsigned?

Posted on 2011-09-12
4
437 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

695 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