How do I print a hex in c through printf?

0

// example
mascara = 0xFF;
blue = COR1 & mascara // color a macro I've used
printf ("% s \ n", blue); // bold doubts

    
asked by anonymous 26.08.2017 / 21:57

1 answer

1

To print a HEX in C we have the options:

  • %i Prints the corresponding integer value.
  • %x Prints the normal HEX value

You can also specify how many houses you want to print using% 4x for 4 houses for example or% 04x to complete the numbers on the left with zeros.

See the ideone .

    
26.08.2017 / 22:20