Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
int a= 5^8 is working fine

but

int a=5;
int b=8;
int c=a^b gives me error plz tell how to resolve the solution i want to by variable,
Posted
Comments
[no name] 30-Oct-12 9:55am    
Gives me same result ... 13... what is the error pls explain more.
lukeer 30-Oct-12 10:08am    
Sure you're using int? Not byte? It was common to XOR bytes where I worked and that gave errors in assigning the result of a XOR to one byte because the result is an int and therefore formally too large to fit into a single byte. Can be solved by casting.
BillW33 30-Oct-12 12:12pm    
The last statement does not have a semicolon ";" at the end, is that your error?

1 solution

What error are you getting?

C#
public int Test()
{
   int a = 5;
   int b = 8;
   int c = a ^ b;

   return c;
}


Works fine for me...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900