Use bitwise 'or' : Bit OR « Data Type « C / ANSI-C






Use bitwise 'or'

#include <stdio.h>

int main(void)
{
  short i;

  i = 1;
  i = i | 32768;
  printf("%hd", i);

  return 0;
}


           
       








Related examples in the same category