Read the FAQ on bit shifting. While you're at it, read the FAQ on why void main is wrong.Originally Posted by draggy
Quzah.
Read the FAQ on bit shifting. While you're at it, read the FAQ on why void main is wrong.Originally Posted by draggy
Quzah.
Hope is the first step on the road to disappointment.
Originally Posted by quzahmost important partCode:int main() { unsigned char a = 'a'; unsigned char c = 0; unsigned char b[8]; char mask = 1; int i; for(i = 8; i > 0; i--) { printf("%d", a & mask); b[i - 1] = a & mask; a >>= 1; } printf("\n"); for(i = 0; i < 8; i++) { c |= b[i]; c <<= 1; if(b[i] == 1) { printf("1"); } else { printf("0"); } } printf("\n%c\n", c); return 0; }
nothing change still get the same old error result....Code:c |= b[i]; //means c = c | b[i]; c <<= 1;//means c = c << 1;
Fascinating I'm sure, but what exactly do you expect to get? People sure don't know how to ask people to help them. Picture a conversation with someone:
You: This doesn't work.
Them: That's nice.
You: Fix it.
Them: What's wrong?
You: This doesn't work.
That's all well and good, but how about you actually tell us a bit more. How about we take a different turn in our conversation?
You: This doesn't work.
Them: That's nice.
You: Fix it.
Them: What's wrong?
You: Well I input this, and I'm supposed to get this. But I don't, I get that instead.
See how much better that is? Now you try.
Quzah.
Hope is the first step on the road to disappointment.
Since I'm such a nice guy, here's a hint:?uoy naC .tahw tuo erugif etiuq t'nac I .senil owt esoht htiw gnorw gnihtemos evah uoy ,revewoh ,trap tcerroc eht detouq evah ot mees uoYmost important part
Code:c |= b[i]; //means c = c | b[i]; c <<= 1;//means c = c << 1;
Quzah.
Hope is the first step on the road to disappointment.
fixed the problem...
Thanks
ahahahaOriginally Posted by quzah
Interesting way to get your point accross.
"So you're one of those condescending UNIX computer users?"
"Here's a nickel, kid. Get yourself a better computer."