1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Conversion of decimal to binary in C programming n store in arrays

Discussion in 'Software Development' started by Zenoba, Oct 1, 2008.

Thread Status:
Not open for further replies.
  1. Zenoba

    Zenoba Thread Starter

    Joined:
    Oct 1, 2008
    Messages:
    4
    Can someone give me an idea to convert decimal numbers into its binary equivalent and store each binary in arrays in C programming language??
     
  2. mt2002

    mt2002

    Joined:
    Sep 14, 2005
    Messages:
    919
    By default all integers are already stored as binary numbers, so to obtain each bit just use a bit mask. (This assumes the integer is stored as a data type int)
     
  3. IMM

    IMM

    Joined:
    Feb 1, 2002
    Messages:
    3,257
    I am also unclear as to what you want.
    If you want to convert the number to a array of strings for printing -- most C and Cpp compilers have an itoa extension of some form (usually several of 'em for different input types) to perform the conversion to string.
    For binary - the radix is 2
    see - http://en.wikipedia.org/wiki/Itoa
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Conversion decimal binary
  1. 3251kapil
    Replies:
    1
    Views:
    520
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/755142

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice