
-----------------------------------
Justin_
Wed Feb 15, 2006 9:35 pm

char arrays
-----------------------------------
I don't know, I feel like I'm not learning anything.  I figured that I'd use streams to and convert to them to chars with the transform function, but then I realized I needed a unary function that would deal with the chars.  

So then I started to write a test version of just such a function when I ran into some complications that I don't understand and I feel stupid and retarded for not understanding.

Here's the code.  


#include 

using namespace std;

char toBinary(char hexNum)
{
   char charArray

-----------------------------------
wtd
Wed Feb 15, 2006 10:08 pm


-----------------------------------
One immediate problem jumps out at me.  When you call toBinary, you're providing a const char*, but your function takes a char.

-----------------------------------
Justin_
Wed Feb 15, 2006 11:10 pm


-----------------------------------
Yeah I don't get how it figures its a constant char.  If i declare it a char, and then pass it a char, even though its a constant char shouldn't it be treated as a char?  

But thanks though, I didn't realize that was what the compiler was talking about when it said error converting from const char to char.

-----------------------------------
wtd
Wed Feb 15, 2006 11:12 pm


-----------------------------------
Chars are delineated with single quotes.  String literals are surrounded by double quotes.

-----------------------------------
Justin_
Wed Feb 15, 2006 11:36 pm


-----------------------------------
Oh!  and i realized my other problem was not doubling up on the equal signs.  *smacks himself*

But I'm not even going to bother doing it this way, I'll just stick to strings since it will be much easier.
