Thread: Binary to decimal and reverse

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    young grasshopper jwroblewski44's Avatar
    Join Date
    May 2012
    Location
    Where the sidewalk ends
    Posts
    294
    Well the way you declare str and initialize it using double-quotes means that it is stored in read-only memory, and effectively is a constant that can not be manipulated. That is not the problem, however, it is when you attempt to assign the character array to num on line 9. What you will get is the ascii value of the character in the first position in the array, if you can even do that assignment.

  2. #2
    Registered User
    Join Date
    Feb 2013
    Posts
    100
    Quote Originally Posted by jwroblewski44 View Post
    Well the way you declare str and initialize it using double-quotes means that it is stored in read-only memory, and effectively is a constant that can not be manipulated. That is not the problem, however, it is when you attempt to assign the character array to num on line 9. What you will get is the ascii value of the character in the first position in the array, if you can even do that assignment.
    So what's a good/simple way to get around that?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char to binary and reverse
    By kraghavan in forum C++ Programming
    Replies: 6
    Last Post: 06-03-2010, 12:00 PM
  2. binary to decimal
    By juancardenas in forum C Programming
    Replies: 1
    Last Post: 02-19-2003, 02:47 PM
  3. Reverse of a Binary
    By xeneize in forum C++ Programming
    Replies: 3
    Last Post: 10-07-2002, 08:29 AM
  4. binary to decimal
    By jk81 in forum C Programming
    Replies: 1
    Last Post: 09-13-2002, 05:20 AM
  5. decimal to binary, decimal to hexadecimal and vice versa
    By Unregistered in forum C++ Programming
    Replies: 9
    Last Post: 12-08-2001, 11:07 PM