![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
What practical use of Bits and Hexadecimal for C programmer?I am new to C programming, but I have come a long way though
Can someone explain as to how does the knowledge of bit manipulation and hexadecimal knowledge come to use in C programming. I know computers work in binary form but does a C programmer really have to know the binary and hexadecimal format? Where is a C programmer use them? As an analogy, it is similar to that even though the computers work at very low level assembly language form the programmer does not need to know assembly language to get by and not knowing assembly language does not make a C programmer handicapped in any way. Thanks in advance Shrikharan |
|
#2
|
||||
|
||||
Re: What practical use of Bits and Hexadecimal for C programmer?Bit Manipulation is important because There are many cases where you need to look at specific bits in a word, or to save space you use a 32 bit word to store the values of flags (on/off values) instead of 32 words, one for each flag.
Or consider that wooden puzzle with 21 holes in a triangle shape, 20 golf tees are placed in the holes leaving one open. The puzzle is solved by jumping tees until only one is left. If you want to program a solution to this puzzle in the smallest space you will need either 1) 2 dimensional array of 20 x 21 words (20 moves, 21 holes), each word representing a hole either with or without a tee. 420 words, 13440 bits 2) 1 dimensional array of 20 words, 21 bits of of each word represents a hole. Total of 20 words, 640 bits. With bit manipulation you can deal with each bit individually. -------------------- Hex is also extremely important to understand. It makes the bit manipulation much easier to debug/test as well as many other benefits. For now you can just take my word for it. Once you learn hex you'll understand why... __________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
Recent GIDBlog
Toyota - 2008 November Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problems typecasting an int to a string | holbrook | C++ Forum | 9 | 07-May-2004 19:59 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The