Re: [ilugd] How to represent a number as binary in C

2003-12-28 Thread Jagmeet Singh Hanspal
Hi Kapil, HexaDecimal = 0x or 0X Octal = 0nn Decimal = ddd Binary = None :( for printf or scanf use %x %d = decimal %x = HexaDecimal %o = Octal %? = Binary :( Similarly, /008 = 010, /009 = 011 (Octal representations) /x0A = 10, /x0B = 011 (HexaDecimal representations) Just be comfortable with

Re: [ilugd] How to represent a number as binary in C

2003-12-27 Thread Kapil Sethi
Hi, No it is not intended as a test. Actually, I have case before me where a 32 bit register is used to store varying number of fields depending on the situation (network packet in my case). so sometimes a field is 7 bits in other cases it is 13 bits and so on. So I wanted to avoid doing binary

Re: [ilugd] How to represent a number as binary in C

2003-12-27 Thread Bhaskar Dutta
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Saturday 27 Dec 2003 12:27 pm, KS Kapil Sethi said: KS Hi, KS KS No it is not intended as a test. KS KS Actually, I have case before me where a 32 bit register is used to store KS varying number of fields depending on the

[ilugd] How to represent a number as binary in C

2003-12-26 Thread Kapil Sethi
Hi, We all know that in C, to represent a number in hexadecimal we prefix the number with a 0x eg. 0x100 is hexadecimal. 1. What suffix/prefix is used if we want to represent a binary number? 2. What suffix/prefix is used if we want to represent an octal number? Thanks Kapil Sethi

Re: [ilugd] How to represent a number as binary in C

2003-12-26 Thread LinuxLingam
On Fri, 2003-12-26 at 16:23, Kapil Sethi wrote: Hi, We all know that in C, ...[snip] 1. What suffix/prefix is used if we want to represent a binary number? 2. What suffix/prefix is used if we want to represent an octal number? Thanks Kapil Sethi hey kapil, sure you are not shoving

Re: [ilugd] How to represent a number as binary in C

2003-12-26 Thread ANUJ SEHGAL
Hey Kapil, Hmm... Homework or test question??? ;) Anyway, here is a list of how to represent number in C, C++ and Java: 1. Octal - To represent octal prefix a number with 0. Eg: 074728 is an octal number. 2. Hex - To represent Hexadecimal prefix a 0x. Eg: 0x1137 is a