C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 29th, 2002, 03:50 PM
php_rocks php_rocks is offline
<?php
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Wyoming, USA
Posts: 41 php_rocks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
Question bits, bytes, etc...

hey,

i am just starting C programming.... and i am having trouble with all this bits and bytes and the range of types and such...

if someone could help me understand what bits are and how they apply to C programming i would appreciate it

-sean
__________________
"I speak English, can you type it?" -Everett_XML

Reply With Quote
  #2  
Old September 30th, 2002, 11:23 AM
MJEggertson MJEggertson is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2002
Location: Seattle WA
Posts: 863 MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 13
A bit is a singular binary value. That is, one bit is either 0 or 1. On or off. True or false. Ying or yang... So a bit is the smallest possible data unit for a computer.

A byte is a collection of eight bits. Since one bit can hold 2 values, a byte can hold 2^8 = 256 values, from 00000000 to 11111111 if you use the traditional 0/1 numeric representation.

That's pretty much it. It isn't really anything specific about C, bits/bytes/etc are really just general computing names.

Reply With Quote
  #3  
Old September 30th, 2002, 08:24 PM
Optix Optix is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 36 Optix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 11
Yeah, and if you want to compare bits you can use bitwise operators. Such as lets say we want 0000 1111 and we want to mask it with 0101 1111 you can use hex and say that 1111 = 15 which equals F and 0101 = 5 so we can have


0x5F & 0x0F

would compare the bits.

EX.

0101 1111
&0000 1111
0101 1111


Sorry if this confuses you lol but its kinda hard to explain. There is another post about this question try searching for it its called "Bitwise Operators".

Maybe scorpian or someonne else can help you better.

Anyways, Hope this helped a lil bit

PS: Oh yea if you are asking why you would need to do this, i have no clue but whatever.

Reply With Quote
  #4  
Old October 1st, 2002, 01:05 AM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is online now
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,406 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 10 h 18 m 59 sec
Reputation Power: 4080
>>0101 1111
>>&0000 1111
>>---------------------
>> 0101 1111


Optix, that's not a bitwise and operation you have described there. That's a bitwise or operation 0x5F & 0x0F = 0x0F

Reply With Quote
  #5  
Old October 1st, 2002, 03:18 PM
Optix Optix is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 36 Optix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 11
oh oops

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > bits, bytes, etc...

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap