Search This Blog

Saturday, October 4, 2014

WAP to toggle a bit at given position in given 32-bits number

1:  main()  
2:  {  
3:    int num = 0xfcd78f11;  
4:    int pos = 10;  
5:    num = num ^ (1<< pos-1);  
6:    printf("res = %d\n",res);  
7:  }   

No comments:

Post a Comment