Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi,
i have a c program as below. Does anybody know why the output c and d always equals to 1, even the parameter of or have different values ?
well, what i know to do is:
eg. num = 10100001 01011010 (short num)
c = 0 (unsigned char c)num or c => 01011010 (the last 8 bits of num)
c is declared unsigned char, because i need to to store this value into an array of char (char len[2]). And num needs to be 2 bytes long, therefore i declare it as type short.#include
#includevoid or(short num)
{
unsigned char c = 0;
short d = 0 ;c = num || c;
d = num || d;printf("c = num || c : %d \n", c);
printf("d = num || d : %d \n", d);
return;
}
int main(void)
{
or(259);return 0;
}thanks a lot!! thanx
WantToKnow

![]() |
C Reference Like php.net
|
Visual C++
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |