Hi Kapil,

Hexadecimal representation = 0x or 0X
Octal representation = 0nn (i.e. numbers startiung with a "0")
Binary representation = None....

Hexadecimal and Octal representations along with Bit Manipulation
instructions are helpful for doing all the Binary work.

And we can I/O in C using %x in the following formats (HexaD or Octal or
Decimal)
like;
printf("%d", &val);     // Output is Decimal number
printf("%o", &val);     // Output is Octal number
printf("%x", &val);     // Output is HexaDecimal number

Just be comfortable with Hexadecimal system and binary manipulation would
come easy.
 --
Jagmeet Singh Hanspal
Embedded Systems Engineer
ALBA Control Systems Limited,
Noida.
http://www.albasystems.com

:: Visit me at ::
http://mcu.cjb.net

>> .. truncated.

> Message: 3
> Date: Fri, 26 Dec 2003 16:23:03 +0530
> From: "Kapil Sethi" <[EMAIL PROTECTED]>
> Subject: [ilugd] How to represent a number as binary in C
> To: "The Linux-Delhi mailing list" <[EMAIL PROTECTED]>
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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
>
>
> .. truncated...



_______________________________________________
ilugd mailing list
[EMAIL PROTECTED]
http://frodo.hserus.net/mailman/listinfo/ilugd

Reply via email to