Solved

# what is the symbol to mention as binary in c language  ?

Posted on 2012-08-28
488 Views
Last Modified: 2012-09-10
16 -> equalant hexa decimal 0x10
12 -> equalant octal         010
10 -> what is equalant for binary  ?

before "0x" is to mention hexadecimal
before "0" is to mention octal
before "?"  what is the symbol to mention binary ?
0
Question by:softwareachiever
3 Comments

LVL 20

Assisted Solution

There is none. The C standard allows only octal, decimal and hex number literals.
It is however fairly easy to write a given binary number as hex or octal number: simply group the digits in groups of 3 (for otal) or 4 (for hex) starting from the right and convert these single digits in your head.
E.g. to write the 1001101101 goup this to  1,001,101,101, hence write 01155.
Or group 10,0110,1101 and hence write 0x26d.
0

LVL 13

Assisted Solution

I would recommend learning it, but the calculator on Win7 does it, as well as Google.
Search "1001011 to hex"

But yes, I found it annoying when doing bit masking in VB.NET as well.
0

LVL 31

Accepted Solution

Since there is no symbol like 0x for hex to express binary, if you have a binary value in a text string, then you can convert it to decimal or hex yourself with your own function(s). Here are some links to consider so that you do not have to start from scratch:
http://www.cplusplus.com/reference/clibrary/cstdlib/strtoul/
http://www.cplusplus.com/forum/windows/35848/
0

## Write Comment

Please enter a first name

Please enter a last name

We will never share this with anyone.

## Featured Post

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

#### 779 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

#### Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!