Connecting Tech Pros Worldwide Forums | Help | Site Map

Interchange 2 nibbles of byte

Sreejith K
Guest
 
Posts: n/a
#1: Jul 19 '05
How to interchange the two nibbles of a byte without
using any bitwise operator.

Lasse Skyum
Guest
 
Posts: n/a
#2: Jul 19 '05

re: Interchange 2 nibbles of byte


unsigned char a;
a = a * 16 + a/16;

But why would you want to do that?? What kind of system doesn't have bitwise
operators?

--
Lasse


Megan
Guest
 
Posts: n/a
#3: Jul 19 '05

re: Interchange 2 nibbles of byte


On Fri, 14 Nov 2003 08:08:18 +0100, "Lasse Skyum" <no spam> wrote:
[color=blue]
>unsigned char a;
>a = a * 16 + a/16;
>
>But why would you want to do that?? What kind of system doesn't have bitwise
>operators?[/color]

Can you say homework assignment?
M
Lasse Skyum
Guest
 
Posts: n/a
#4: Jul 19 '05

re: Interchange 2 nibbles of byte


> Can you say homework assignment?

ahh, right...


aks
Guest
 
Posts: n/a
#5: Jul 19 '05

re: Interchange 2 nibbles of byte


nop i suppose it's the question asked in interviews ;)

Lasse Skyum wrote:[color=blue]
>
> unsigned char a;
> a = a * 16 + a/16;
>
> But why would you want to do that?? What kind of system doesn't have bitwise
> operators?
>
> --
> Lasse[/color]
Closed Thread


Similar C / C++ bytes